From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1175576-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id CC7F01382C5
	for <garchives@archives.gentoo.org>; Sun, 31 May 2020 05:13:30 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0D04EE0893;
	Sun, 31 May 2020 05:13:30 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id E5039E0880
	for <gentoo-commits@lists.gentoo.org>; Sun, 31 May 2020 05:13:29 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 438BE34EF3B
	for <gentoo-commits@lists.gentoo.org>; Sun, 31 May 2020 05:13:28 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 935B126A
	for <gentoo-commits@lists.gentoo.org>; Sun, 31 May 2020 05:13:26 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <1590901997.dd5a41de524cfdebe47425e70513f95f9937e406.robbat2@OpenRC>
Subject: [gentoo-commits] proj/netifrc:master commit in: net/
X-VCS-Repository: proj/netifrc
X-VCS-Files: net/dhcpcd.sh
X-VCS-Directories: net/
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: dd5a41de524cfdebe47425e70513f95f9937e406
X-VCS-Branch: master
Date: Sun, 31 May 2020 05:13:26 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 267e7c6c-8164-4d12-b6cd-8fd046665fc6
X-Archives-Hash: f8707a4ff68c0252ff60ef01c55b8878

commit:     dd5a41de524cfdebe47425e70513f95f9937e406
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Thu May 21 16:35:32 2020 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun May 31 05:13:17 2020 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=dd5a41de

net/dhcpcd.sh: fetch pidfile location from dhcpcd

There's a -P switch for this but we also need to take into account the
-4 and -6 switches as they both alter the pidfile's name.

Bug: https://bugs.gentoo.org/718114
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 net/dhcpcd.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh
index 0a306b8..c0639e0 100644
--- a/net/dhcpcd.sh
+++ b/net/dhcpcd.sh
@@ -16,9 +16,12 @@ _config_vars="$_config_vars dhcp dhcpcd"
 
 dhcpcd_start()
 {
-	local args= opt= opts= pidfile="/run/dhcpcd-${IFACE}.pid" new=true
+	# check for pidfile after we gathered the user's opts because they can
+	# alter the pidfile's name (#718114)
+	local args= opt= pidfile= opts= new=true
 	eval args=\$dhcpcd_${IFVAR}
 	[ -z "${args}" ] && args=${dhcpcd}
+	pidfile="$(dhcpcd -P ${args} ${IFACE})"
 
 	# Get our options
 	eval opts=\$dhcp_${IFVAR}
@@ -75,7 +78,13 @@ dhcpcd_start()
 
 dhcpcd_stop()
 {
-	local pidfile="/run/dhcpcd-${IFACE}.pid" opts= sig=SIGTERM
+	local args= pidfile= opts= sig=SIGTERM
+
+	# check for pidfile after we gathered the user's opts because they can
+	# alter the pidfile's name (#718114)
+	eval args=\$dhcpcd_${IFVAR}
+	[ -z "${args}" ] && args=${dhcpcd}
+	pidfile="$(dhcpcd -P ${args} ${IFACE})"
 	[ ! -f "${pidfile}" ] && return 0
 
 	ebegin "Stopping dhcpcd on ${IFACE}"