X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Fconfigfile.c;h=f367ee9c3973d19ddc0acba2e1adc46a2cdeadf6;hb=233ef890d210e7f231ebbc474894e90032ba49b1;hp=f34adae319a63928e8346be26e28b0a4dbe8f6ca;hpb=3489284330462f4edc85a75445a5cc8014e29db0;p=collectd.git diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index f34adae3..f367ee9c 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -156,9 +156,12 @@ static int cf_dispatch (const char *type, const char *orig_key, int ret; int i; + if (orig_key == NULL) + return (EINVAL); + DEBUG ("type = %s, key = %s, value = %s", ESCAPE_NULL(type), - ESCAPE_NULL(orig_key), + orig_key, ESCAPE_NULL(orig_value)); if ((cf_cb = cf_search (type)) == NULL) @@ -199,8 +202,6 @@ static int cf_dispatch (const char *type, const char *orig_key, free (key); free (value); - DEBUG ("cf_dispatch: return (%i)", ret); - return (ret); } /* int cf_dispatch */ @@ -759,6 +760,9 @@ static oconfig_item_t *cf_read_dir (const char *dir, filenames[filenames_num - 1] = sstrdup (name); } + if (filenames == NULL) + return (root); + qsort ((void *) filenames, filenames_num, sizeof (*filenames), cf_compare_string);