From: Amos Jeffries Date: Mon, 2 Jun 2008 11:07:57 +0000 (-0600) Subject: Author: Henrik Nordstrom X-Git-Tag: SQUID_3_0_STABLE7~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae607b376fba41ad9bf7667da3109f552424ae5b;p=thirdparty%2Fsquid.git Author: Henrik Nordstrom Simplify linux capabilities version check to avoid repeated #ifdefs cluttering the code --- diff --git a/src/tools.cc b/src/tools.cc index d1cb7e4529..ee6eafad1c 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1357,27 +1357,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; }