Code

common.c: Use _LINUX_CAPABILITY_VERSION_3 in cap_header
authorThomas Deutschmann <whissi@gentoo.org>
Tue, 11 Oct 2016 14:16:23 +0000 (16:16 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 12 Oct 2016 14:41:00 +0000 (16:41 +0200)
While check_capability() function already requires
_LINUX_CAPABILITY_VERSION_3 via "#ifdef" since commit 448627953c we still
set the cap_header's version to deprecated _LINUX_CAPABILITY_VERSION. This
results in a warning like

 > capability: warning: `collectd' uses 32-bit capabilities (legacy support in use)

from the kernel when a plugin (like iptables) calls our check_capability()
function.

With this commit we will set cap_header to kernel's current capability
version (_LINUX_CAPABILITY_VERSION_3), which is default since
kernel 2.6.26.

Signed-off-by: Florian Forster <octo@collectd.org>
src/daemon/common.c

index e4894493222e91455fedc43d7b571aa7b6887938..477d75990515c21ea3eb08b78c59450d0da45012 100644 (file)
@@ -1698,7 +1698,7 @@ int check_capability (int capability) /* {{{ */
        }
 
        cap_header->pid = getpid();
-       cap_header->version = _LINUX_CAPABILITY_VERSION;
+       cap_header->version = _LINUX_CAPABILITY_VERSION_3;
        if (capget(cap_header, cap_data) < 0)
        {
                ERROR("check_capability: capget failed");