diff options
author | Martin Nagy <mnagy@redhat.com> | 2008-12-16 16:46:40 +0100 |
---|---|---|
committer | Martin Nagy <mnagy@redhat.com> | 2009-02-11 20:40:41 +0100 |
commit | b74b20b7395d0322f39dfc7d146aa5df71392613 (patch) | |
tree | 5cf0f0a3fa3b4ea5f7875bcd3ff6a331d62df5f9 /bin/named | |
parent | 5ff887d58ea779cae28fcae2c2e1222bec13b5f9 (diff) | |
download | bind_dynamic-b74b20b7395d0322f39dfc7d146aa5df71392613.tar.gz bind_dynamic-b74b20b7395d0322f39dfc7d146aa5df71392613.tar.xz bind_dynamic-b74b20b7395d0322f39dfc7d146aa5df71392613.zip |
Allow zero 'arg' configuration directives.
Diffstat (limited to 'bin/named')
-rw-r--r-- | bin/named/server.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/bin/named/server.c b/bin/named/server.c index 12ac597..1ed22e7 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -877,16 +877,21 @@ configure_dynamic_db(const cfg_obj_t *dynamic_db, isc_mem_t *mctx, /* Create a list of arguments. */ obj = NULL; - CHECK(cfg_map_get(options, "arg", &obj)); + result = cfg_map_get(options, "arg", &obj); + if (result == ISC_R_NOTFOUND) + len = 0; + else if (result == ISC_R_SUCCESS) + len = cfg_list_length(obj, isc_boolean_false); + else + goto cleanup; - len = cfg_list_length(obj, isc_boolean_false); - if (len == 0) { - argv = NULL; - } else { - len++; - argv = isc_mem_allocate(mctx, len * sizeof(const char *)); - if (argv == NULL) - CHECK(ISC_R_NOMEMORY); + /* Account for the last terminating NULL. */ + len++; + + argv = isc_mem_allocate(mctx, len * sizeof(const char *)); + if (argv == NULL) { + result = ISC_R_NOMEMORY; + goto cleanup; } for (element = cfg_list_first(obj), i = 0; element != NULL; |