projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.7'
[collectd.git]
/
src
/
daemon
/
common.c
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
1fa99eb
..
c45304e
100644
(file)
--- a/
src/daemon/common.c
+++ b/
src/daemon/common.c
@@
-37,10
+37,6
@@
#include "plugin.h"
#include "utils_cache.h"
#include "plugin.h"
#include "utils_cache.h"
-#ifdef HAVE_MATH_H
-#include <math.h>
-#endif
-
/* for getaddrinfo */
#include <netdb.h>
#include <sys/types.h>
/* for getaddrinfo */
#include <netdb.h>
#include <sys/types.h>
@@
-1568,16
+1564,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) /* {{{ */