From patchwork Thu Oct 1 15:29:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Bryant X-Patchwork-Id: 525105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 6348B140082 for ; Fri, 2 Oct 2015 01:29:25 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id ADF3E10CC8; Thu, 1 Oct 2015 08:29:23 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id F02C910CC7 for ; Thu, 1 Oct 2015 08:29:22 -0700 (PDT) Received: from bar2.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 74C8C1E030D for ; Thu, 1 Oct 2015 09:29:22 -0600 (MDT) X-ASG-Debug-ID: 1443713361-03dc537fe09d3590001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id DR2ZSkOJyJl7NwbR (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 01 Oct 2015 09:29:21 -0600 (MDT) X-Barracuda-Envelope-From: rbryant@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 1 Oct 2015 15:29:21 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 1502DC0B64A3; Thu, 1 Oct 2015 15:29:20 +0000 (UTC) Received: from x1c.redhat.com (ovpn-112-51.phx2.redhat.com [10.3.112.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t91FTHUx023746; Thu, 1 Oct 2015 11:29:18 -0400 X-CudaMail-Envelope-Sender: rbryant@redhat.com From: Russell Bryant To: dev@openvswitch.org X-CudaMail-MID: CM-E2-930041405 X-CudaMail-DTE: 100115 X-CudaMail-Originating-IP: 209.132.183.28 Date: Thu, 1 Oct 2015 11:29:16 -0400 X-ASG-Orig-Subj: [##CM-E2-930041405##][PATCH] Fix build when HAVE_LIBCAPNG is not defined. Message-Id: <1443713356-17985-1-git-send-email-rbryant@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-GBUdb-Analysis: 0, 209.132.183.28, Ugly c=0.308711 p=-0.4 Source Normal X-MessageSniffer-Rules: 0-0-0-4120-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1443713361 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.23078 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH] Fix build when HAVE_LIBCAPNG is not defined. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" The function daemon_become_new_user_linux was conditionally defined but then used in code unconditionally. If HAVE_LIBCAPNG is not defined, the function would never be called, but it still must exist. Adjust the #if guard around the function to be around the body of the function instead of outside of its definition to ensure the function is always defined, even if empty. This issue was introduced in e91b927d8966bfcb9768225392324dde4fd7d7f6. Signed-off-by: Russell Bryant --- lib/daemon-unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c index 6438061..868e2c9 100644 --- a/lib/daemon-unix.c +++ b/lib/daemon-unix.c @@ -804,10 +804,10 @@ daemon_become_new_user_unix(void) /* Linux specific implementation of daemon_become_new_user() * using libcap-ng. */ -#if defined __linux__ && HAVE_LIBCAPNG static void -daemon_become_new_user_linux(bool access_datapath) +daemon_become_new_user_linux(bool access_datapath OVS_UNUSED) { +#if defined __linux__ && HAVE_LIBCAPNG int ret; ret = capng_get_caps_process(); @@ -847,8 +847,8 @@ daemon_become_new_user_linux(bool access_datapath) VLOG_FATAL("%s: libcap-ng fail to switch to user and group " "%d:%d, aborting", pidfile, uid, gid); } -} #endif +} static void daemon_become_new_user__(bool access_datapath)