From bf7aa5239431db821b6fdb4947c9b0ce64a6a084 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 5 Apr 2018 16:18:23 +0200 Subject: [PATCH] sys_linux: fix building with old libcap versions The cap_get_bound() function and CAP_IS_SUPPORTED macro were added in libcap-2.21. Check if the macro is defined before use. The sys/capability.h header from libcap-2.16 and earlier disables the linux/types.h header, which breaks the linux/ptp_clock.h header. Change the order to include sys/capability.h as the last system header. --- sys_linux.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys_linux.c b/sys_linux.c index f4b532d..3d54483 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -42,11 +42,6 @@ #include #endif -#ifdef FEAT_PRIVDROP -#include -#include -#endif - #if defined(FEAT_PHC) || defined(HAVE_LINUX_TIMESTAMPING) #include #endif @@ -66,6 +61,11 @@ #endif #endif +#ifdef FEAT_PRIVDROP +#include +#include +#endif + #include "sys_linux.h" #include "sys_timex.h" #include "conf.h" @@ -385,7 +385,7 @@ test_step_offset(void) static void report_time_adjust_blockers(void) { -#ifdef FEAT_PRIVDROP +#if defined(FEAT_PRIVDROP) && defined(CAP_IS_SUPPORTED) if (CAP_IS_SUPPORTED(CAP_SYS_TIME) && cap_get_bound(CAP_SYS_TIME)) return; LOG(LOGS_WARN, "CAP_SYS_TIME not present");