From: Henrik Nordstrom Date: Thu, 15 Oct 2009 23:57:26 +0000 (+0200) Subject: Remove PUSH_CAP macro, and fix #if/#endif for non-Linux platforms X-Git-Tag: SQUID_3_2_0_1~653^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=725cea1372513d1e94d95f2fdd54366ef91229d5;p=thirdparty%2Fsquid.git Remove PUSH_CAP macro, and fix #if/#endif for non-Linux platforms --- diff --git a/src/tools.cc b/src/tools.cc index 7144a78312..7b2a36f51a 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1240,7 +1240,8 @@ static void restoreCapabilities(int keep) { /* NP: keep these two if-endif separate. Non-Linux work perfectly well without Linux syscap support. */ -#if defined(_SQUID_LINUX_) && HAVE_SYS_CAPABILITY_H +#if defined(_SQUID_LINUX_) +#if HAVE_SYS_CAPABILITY_H cap_t caps; if (keep) caps = cap_get_proc(); @@ -1249,19 +1250,17 @@ restoreCapabilities(int keep) if (!caps) { IpInterceptor.StopTransparency("Can't get current capabilities"); } else { -#define PUSH_CAP(cap) cap_list[ncaps++] = (cap) int ncaps = 0; int rc = 0; cap_value_t cap_list[10]; - PUSH_CAP(CAP_NET_BIND_SERVICE); + cap_list[ncaps++] = CAP_NET_BIND_SERVICE; if (IpInterceptor.TransparentActive()) { - PUSH_CAP(CAP_NET_ADMIN); + cap_list[ncaps++] = CAP_NET_ADMIN; #if LINUX_TPROXY2 - PUSH_CAP(CAP_NET_BROADCAST); + cap_list[ncaps++] = CAP_NET_BROADCAST; #endif } -#undef PUSH_CAP cap_clear_flag(caps, CAP_EFFECTIVE); rc |= cap_set_flag(caps, CAP_EFFECTIVE, ncaps, cap_list, CAP_SET); @@ -1275,6 +1274,7 @@ restoreCapabilities(int keep) #else IpInterceptor.StopTransparency("Missing needed capability support."); #endif /* HAVE_SYS_CAPABILITY_H */ +#endif /* _SQUID_LINUX_ */ } void *