From: Henrik Nordstrom Date: Fri, 30 May 2008 15:29:10 +0000 (+0200) Subject: Simplify linux capabilities version check to avoid repeated #ifdefs cluttering the... X-Git-Tag: SQUID_3_1_0_1~49^2~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5f9c5808260aa35867414207a2476b9499a6995;p=thirdparty%2Fsquid.git Simplify linux capabilities version check to avoid repeated #ifdefs cluttering the code --- diff --git a/src/tools.cc b/src/tools.cc index d00ac2d9d0..1b8e7ed82d 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1259,27 +1259,21 @@ static void restoreCapabilities(int keep) { #if defined(_SQUID_LINUX_) && HAVE_SYS_CAPABILITY_H +#ifndef _LINUX_CAPABILITY_VERSION_1 +#define _LINUX_CAPABILITY_VERSION_1 _LINUX_CAPABILITY_VERSION +#endif cap_user_header_t head = (cap_user_header_t) xcalloc(1, sizeof(*head)); cap_user_data_t cap = (cap_user_data_t) xcalloc(1, sizeof(*cap)); -#ifdef _LINUX_CAPABILITY_VERSION_1 head->version = _LINUX_CAPABILITY_VERSION_1; -#else - head->version = _LINUX_CAPABILITY_VERSION; -#endif if (capget(head, cap) != 0) { debugs(50, 1, "Can't get current capabilities"); goto nocap; } -#ifdef _LINUX_CAPABILITY_VERSION_1 if (head->version != _LINUX_CAPABILITY_VERSION_1) { debugs(50, 1, "Invalid capability version " << head->version << " (expected " << _LINUX_CAPABILITY_VERSION_1 << ")"); -#else - if (head->version != _LINUX_CAPABILITY_VERSION) { - debugs(50, 1, "Invalid capability version " << head->version << " (expected " << _LINUX_CAPABILITY_VERSION << ")"); -#endif goto nocap; }