projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Build system: enable the "df" plugin when getmntent_r() is available.
[collectd.git]
/
src
/
daemon
/
common.c
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
1fa99eb
..
8502208
100644
(file)
--- a/
src/daemon/common.c
+++ b/
src/daemon/common.c
@@
-352,6
+352,9
@@
int strjoin(char *buffer, size_t buffer_size, char **fields, size_t fields_num,
buffer_req += sep_len;
buffer_req += field_len;
buffer_req += sep_len;
buffer_req += field_len;
+ if (buffer_size == 0)
+ continue;
+
if ((i != 0) && (sep_len > 0)) {
if (sep_len >= avail) {
/* prevent subsequent iterations from writing to the
if ((i != 0) && (sep_len > 0)) {
if (sep_len >= avail) {
/* prevent subsequent iterations from writing to the
@@
-1568,16
+1571,26
@@
void strarray_free(char **array, size_t array_len) /* {{{ */
#if HAVE_CAPABILITY
int check_capability(int arg) /* {{{ */
{
#if HAVE_CAPABILITY
int check_capability(int arg) /* {{{ */
{
- cap_value_t cap = (cap_value_t)arg;
+ cap_value_t cap_value = (cap_value_t)arg;
+ cap_t cap;
+ cap_flag_value_t cap_flag_value;
- if (!CAP_IS_SUPPORTED(cap))
+ if (!CAP_IS_SUPPORTED(cap
_value
))
return (-1);
return (-1);
- i
nt have_cap = cap_get_bound(cap);
- if (have_cap != 1)
+ i
f (!(cap = cap_get_proc())) {
+ ERROR("check_capability: cap_get_proc failed.");
return (-1);
return (-1);
+ }
- return (0);
+ if (cap_get_flag(cap, cap_value, CAP_EFFECTIVE, &cap_flag_value) < 0) {
+ ERROR("check_capability: cap_get_flag failed.");
+ cap_free(cap);
+ return (-1);
+ }
+ cap_free(cap);
+
+ return (cap_flag_value != CAP_SET);
} /* }}} int check_capability */
#else
int check_capability(__attribute__((unused)) int arg) /* {{{ */
} /* }}} int check_capability */
#else
int check_capability(__attribute__((unused)) int arg) /* {{{ */