index ae3e79899d2eddf1304bcc00ba178289b3602d02..8a7621d2b5fb912b02d64c8c9f86456d42dbea08 100644 (file)
--- a/src/daemon/configfile.c
+++ b/src/daemon/configfile.c
typedef struct cf_value_map_s
{
typedef struct cf_value_map_s
{
- char *key;
+ const char *key;
int (*func) (oconfig_item_t *);
} cf_value_map_t;
typedef struct cf_global_option_s
{
int (*func) (oconfig_item_t *);
} cf_value_map_t;
typedef struct cf_global_option_s
{
- char *key;
+ const char *key;
char *value;
char *value;
- char *def;
+ const char *def;
} cf_global_option_t;
/*
} cf_global_option_t;
/*
/* default to the global interval set before loading this plugin */
memset (&ctx, 0, sizeof (ctx));
ctx.interval = cf_get_default_interval ();
/* default to the global interval set before loading this plugin */
memset (&ctx, 0, sizeof (ctx));
ctx.interval = cf_get_default_interval ();
+ ctx.flush_interval = 0;
+ ctx.flush_timeout = 0;
- for (i = 0; i < ci->children_num; ++i) {
- if (strcasecmp("Globals", ci->children[i].key) == 0)
- cf_util_get_flag (ci->children + i, &flags, PLUGIN_FLAGS_GLOBAL);
- else if (strcasecmp ("Interval", ci->children[i].key) == 0) {
- if (cf_util_get_cdtime (ci->children + i, &ctx.interval) != 0) {
- /* cf_util_get_cdtime will log an error */
- continue;
- }
- }
+ for (i = 0; i < ci->children_num; ++i)
+ {
+ oconfig_item_t *child = ci->children + i;
+
+ if (strcasecmp("Globals", child->key) == 0)
+ cf_util_get_flag (child, &flags, PLUGIN_FLAGS_GLOBAL);
+ else if (strcasecmp ("Interval", child->key) == 0)
+ cf_util_get_cdtime (child, &ctx.interval);
+ else if (strcasecmp ("FlushInterval", child->key) == 0)
+ cf_util_get_cdtime (child, &ctx.flush_interval);
+ else if (strcasecmp ("FlushTimeout", child->key) == 0)
+ cf_util_get_cdtime (child, &ctx.flush_timeout);
else {
WARNING("Ignoring unknown LoadPlugin option \"%s\" "
"for plugin \"%s\"",
else {
WARNING("Ignoring unknown LoadPlugin option \"%s\" "
"for plugin \"%s\"",
- ci->children[i].key, ci->values[0].value.string);
+ child->key, ci->values[0].value.string);
}
}
}
}
static int dispatch_block_plugin (oconfig_item_t *ci)
{
int i;
static int dispatch_block_plugin (oconfig_item_t *ci)
{
int i;
- char *name;
+ const char *name;
cf_complex_callback_t *cb;
cf_complex_callback_t *cb;
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
+ closedir (dh);
return (NULL);
}
memset (root, 0, sizeof (oconfig_item_t));
return (NULL);
}
memset (root, 0, sizeof (oconfig_item_t));
ERROR ("configfile: Not including `%s/%s' because its"
" name is too long.",
dir, de->d_name);
ERROR ("configfile: Not including `%s/%s' because its"
" name is too long.",
dir, de->d_name);
+ closedir (dh);
for (i = 0; i < filenames_num; ++i)
free (filenames[i]);
free (filenames);
for (i = 0; i < filenames_num; ++i)
free (filenames[i]);
free (filenames);
filenames_num * sizeof (*filenames));
if (tmp == NULL) {
ERROR ("configfile: realloc failed.");
filenames_num * sizeof (*filenames));
if (tmp == NULL) {
ERROR ("configfile: realloc failed.");
+ closedir (dh);
for (i = 0; i < filenames_num - 1; ++i)
free (filenames[i]);
free (filenames);
for (i = 0; i < filenames_num - 1; ++i)
free (filenames[i]);
free (filenames);
}
if (filenames == NULL)
}
if (filenames == NULL)
+ {
+ closedir (dh);
return (root);
return (root);
+ }
qsort ((void *) filenames, filenames_num, sizeof (*filenames),
cf_compare_string);
qsort ((void *) filenames, filenames_num, sizeof (*filenames),
cf_compare_string);
free (name);
}
free (name);
}
+ closedir (dh);
free(filenames);
return (root);
} /* oconfig_item_t *cf_read_dir */
free(filenames);
return (root);
} /* oconfig_item_t *cf_read_dir */
-/*
+/*
* cf_read_generic
*
* Path is stat'ed and either cf_read_file or cf_read_dir is called
* cf_read_generic
*
* Path is stat'ed and either cf_read_file or cf_read_dir is called
@@ -1103,7 +1115,7 @@ int cf_register_complex (const char *type, int (*callback) (oconfig_item_t *))
return (0);
} /* int cf_register_complex */
return (0);
} /* int cf_register_complex */
-int cf_read (char *filename)
+int cf_read (const char *filename)
{
oconfig_item_t *conf;
int i;
{
oconfig_item_t *conf;
int i;