projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into ff/netlib
[collectd.git]
/
src
/
configfile.c
diff --git
a/src/configfile.c
b/src/configfile.c
index
fe2bce3
..
99dded9
100644
(file)
--- a/
src/configfile.c
+++ b/
src/configfile.c
@@
-1,6
+1,6
@@
/**
* collectd - src/configfile.c
/**
* collectd - src/configfile.c
- * Copyright (C) 2005-20
09
Florian octo Forster
+ * Copyright (C) 2005-20
10
Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@
-96,9
+96,10
@@
static cf_global_option_t cf_global_options[] =
{"BaseDir", NULL, PKGLOCALSTATEDIR},
{"PIDFile", NULL, PIDFILE},
{"Hostname", NULL, NULL},
{"BaseDir", NULL, PKGLOCALSTATEDIR},
{"PIDFile", NULL, PIDFILE},
{"Hostname", NULL, NULL},
- {"FQDNLookup", NULL, "
fals
e"},
+ {"FQDNLookup", NULL, "
tru
e"},
{"Interval", NULL, "10"},
{"ReadThreads", NULL, "5"},
{"Interval", NULL, "10"},
{"ReadThreads", NULL, "5"},
+ {"Timeout", NULL, "2"},
{"PreCacheChain", NULL, "PreCache"},
{"PostCacheChain", NULL, "PostCache"}
};
{"PreCacheChain", NULL, "PreCache"},
{"PostCacheChain", NULL, "PostCache"}
};
@@
-700,11
+701,10
@@
static oconfig_item_t *cf_read_generic (const char *path, int depth)
if (status != 0)
{
char errbuf[1024];
if (status != 0)
{
char errbuf[1024];
-
ERROR
("configfile: stat (%s) failed: %s",
+
WARNING
("configfile: stat (%s) failed: %s",
path_ptr,
sstrerror (errno, errbuf, sizeof (errbuf)));
path_ptr,
sstrerror (errno, errbuf, sizeof (errbuf)));
- oconfig_free (root);
- return (NULL);
+ continue;
}
if (S_ISREG (statbuf.st_mode))
}
if (S_ISREG (statbuf.st_mode))
@@
-713,7
+713,7
@@
static oconfig_item_t *cf_read_generic (const char *path, int depth)
temp = cf_read_dir (path_ptr, depth);
else
{
temp = cf_read_dir (path_ptr, depth);
else
{
-
ERROR
("configfile: %s is neither a file nor a "
+
WARNING
("configfile: %s is neither a file nor a "
"directory.", path);
continue;
}
"directory.", path);
continue;
}
@@
-730,6
+730,12
@@
static oconfig_item_t *cf_read_generic (const char *path, int depth)
wordfree (&we);
wordfree (&we);
+ if (root->children == NULL)
+ {
+ oconfig_free (root);
+ return (NULL);
+ }
+
return (root);
} /* oconfig_item_t *cf_read_generic */
/* #endif HAVE_WORDEXP_H */
return (root);
} /* oconfig_item_t *cf_read_generic */
/* #endif HAVE_WORDEXP_H */
@@
-1008,11
+1014,37
@@
int cf_util_get_boolean (const oconfig_item_t *ci, _Bool *ret_bool) /* {{{ */
return (-1);
}
return (-1);
}
- *ret_bool = ci->values[0].value.boolean ?
true : false
;
+ *ret_bool = ci->values[0].value.boolean ?
1 : 0
;
return (0);
} /* }}} int cf_util_get_boolean */
return (0);
} /* }}} int cf_util_get_boolean */
+int cf_util_get_flag (const oconfig_item_t *ci, /* {{{ */
+ unsigned int *ret_value, unsigned int flag)
+{
+ int status;
+ _Bool b;
+
+ if (ret_value == NULL)
+ return (EINVAL);
+
+ b = 0;
+ status = cf_util_get_boolean (ci, &b);
+ if (status != 0)
+ return (status);
+
+ if (b)
+ {
+ *ret_value |= flag;
+ }
+ else
+ {
+ *ret_value &= ~flag;
+ }
+
+ return (0);
+} /* }}} int cf_util_get_flag */
+
/* Assures that the config option is a string. The string is then converted to
* a port number using `service_name_to_port_number' and returned. Returns the
* port number in the range [1-65535] or less than zero upon failure. */
/* Assures that the config option is a string. The string is then converted to
* a port number using `service_name_to_port_number' and returned. Returns the
* port number in the range [1-65535] or less than zero upon failure. */