From: Robert Spalek Date: Sun, 30 Apr 2006 08:19:16 +0000 (+0200) Subject: conf: handle NULL dynamic arrays before calling commit-hooks X-Git-Tag: holmes-import~645^2~10 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ed441a79291b6f585c6dd47197f7ee3faeae3144;p=libucw.git conf: handle NULL dynamic arrays before calling commit-hooks --- diff --git a/lib/conf-section.c b/lib/conf-section.c index 1070409e..46a7fb3e 100644 --- a/lib/conf-section.c +++ b/lib/conf-section.c @@ -16,8 +16,6 @@ #include -#define TRY(f) do { byte *_msg = f; if (_msg) return _msg; } while (0) - /* Dirty sections */ struct dirty_section { @@ -184,7 +182,8 @@ commit_section(struct cf_section *sec, void *ptr, uns commit_all) log(L_ERROR, "Cannot commit node #%d of list %s: %s", idx, ci->name, err); return "commit of a list failed"; } - } + } else if (ci->cls == CC_DYNAMIC) + replace_null_dary(ci, ptr + (addr_int_t) ci->ptr); if (sec->commit) { /* We have to process the whole tree of sections even if just a few changes * have been made, because there are dependencies between commit-hooks and @@ -195,11 +194,8 @@ commit_section(struct cf_section *sec, void *ptr, uns commit_all) if (commit_all || (pos < dirties && dirty.ptr[pos].sec == sec && dirty.ptr[pos].ptr == ptr)) - TRY( sec->commit(ptr) ); + return sec->commit(ptr); } - for (ci=sec->cfg; ci->cls; ci++) - if (ci->cls == CC_DYNAMIC) - replace_null_dary(ci, ptr + (addr_int_t) ci->ptr); return 0; }