From patchwork Sun Oct 4 22:18:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1506 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id EJcRASXlel8mYwAAIUCqbw (envelope-from ) for ; Mon, 05 Oct 2020 05:19:33 -0400 Received: from proxy4.mail.iad3b.rsapps.net ([172.31.255.6]) by director9.mail.ord1d.rsapps.net with LMTP id CLH/ACXlel9kcAAAalYnBA (envelope-from ) for ; Mon, 05 Oct 2020 05:19:33 -0400 Received: from smtp39.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.iad3b.rsapps.net with LMTPS id wN13NSTlel9nOAAA9crAow (envelope-from ) for ; Mon, 05 Oct 2020 05:19:32 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp39.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: e0817332-06eb-11eb-8fdc-5254002be87c-1-1 Received: from [216.105.38.7] ([216.105.38.7:54944] helo=lists.sourceforge.net) by smtp39.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 8B/B9-18898-425EA7F5; Mon, 05 Oct 2020 05:19:32 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kPMdi-0003r7-Bm; Mon, 05 Oct 2020 09:18:38 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPMdg-0003qY-AF for openvpn-devel@lists.sourceforge.net; Mon, 05 Oct 2020 09:18:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qrBdloiTPvoML/FQaiKvludSniQLfkRHsn3rptJHkhQ=; b=aLMeUtGp9hioEP6yuNZnQOhEYU JFQSVfF72oODcr2qSTbTPcJO57LyiLPXs5T8CJMnbLwFpJs/eoOEopPWCb/WI9NN5tlGcYpLKUIzD DNsFkMRbaq7/jxpPtT880e2pGRcuETpSSC/M0yCDyYr26qnwoMuFg8Gnt7z4zdiU5pTM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=qrBdloiTPvoML/FQaiKvludSniQLfkRHsn3rptJHkhQ=; b=d6w0ZEHdOY0z42MMP0silz3q16 r338xLsY3xjNCDN9nMwI4TC3g2wcPRqSjEt7kXRv8bMgCFSRYTEbX/P/m+PuoHh6+wj8e04aWNFDS 2qYbVmvV39pkAE5f1SpQc81IseRvFPr+RsxsS8+Seis5qF+jzgevRLwnA/vSeuZKRbRM=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kPMdZ-00H79D-Hn for openvpn-devel@lists.sourceforge.net; Mon, 05 Oct 2020 09:18:36 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1kPMdB-00062t-Px for openvpn-devel@lists.sourceforge.net; Mon, 05 Oct 2020 11:18:05 +0200 Received: (nullmailer pid 17309 invoked by uid 10006); Mon, 05 Oct 2020 09:18:05 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Mon, 5 Oct 2020 11:18:05 +0200 Message-Id: <20201005091805.17260-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1kPMdZ-00H79D-Hn Subject: [Openvpn-devel] [PATCH] Ignore deprecation warning for daemon on macOS X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox macOS warns that we should posix_spawn instead. However posix_spawn would require a major redesign of code to daemonise or drop the --daemon feature on macOS. Ignore the clang warning in order to allow -Werror compile on macOS. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/init.c | 8 ++++++++ src/plugins/down-root/down-root.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 31ecadcc..61d9cd75 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1237,10 +1237,18 @@ possibly_become_daemon(const struct options *options) { ASSERT(!options->inetd); /* Don't chdir immediately, but the end of the init sequence, if needed */ + +#if defined(__APPLE__) && defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif if (daemon(1, options->log) < 0) { msg(M_ERR, "daemon() failed or unsupported"); } +#if defined(__APPLE__) && defined(__clang__) +#pragma clang diagnostic pop +#endif restore_signal_state(); if (options->log) { diff --git a/src/plugins/down-root/down-root.c b/src/plugins/down-root/down-root.c index c5e5023e..da445c61 100644 --- a/src/plugins/down-root/down-root.c +++ b/src/plugins/down-root/down-root.c @@ -173,10 +173,17 @@ daemonize(const char *envp[]) { fd = dup(2); } +#if defined(__APPLE__) && defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif if (daemon(0, 0) < 0) { warn("DOWN-ROOT: daemonization failed"); } +#if defined(__APPLE__) && defined(__clang__) +#pragma clang diagnostic pop +#endif else if (fd >= 3) { dup2(fd, 2);