Module Name:    src
Committed By:   roy
Date:           Thu Jan  7 22:03:00 UTC 2016

Modified Files:
        src/etc/rc.d: dhcpcd

Log Message:
Use the new -P option to work out which pidfile dhcpcd will use.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/dhcpcd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.4 src/etc/rc.d/dhcpcd:1.5
--- src/etc/rc.d/dhcpcd:1.4	Fri Oct 16 18:06:22 2015
+++ src/etc/rc.d/dhcpcd	Thu Jan  7 22:03:00 2016
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+# $NetBSD: dhcpcd,v 1.5 2016/01/07 22:03:00 roy Exp $
+
 # PROVIDE: dhcpcd
 # REQUIRE: network mountcritlocal
 # BEFORE:  NETWORKING
@@ -13,28 +15,14 @@ extra_commands="reload"
 
 load_rc_config $name
 
-# If the last argument to dhcpcd is a valid interface and the prior argument
-# is not then dhcpcd will start on one interface only and create a pidfile
-# based on the interface name. See PR bin/43490.
+# Work out what pidfile dhcpcd will use based on flags
 if [ -n "$flags" ]; then
 	myflags=$flags
 else
 	eval myflags=\$${name}_flags
 fi
-ifname="${myflags##* }"
-myflags="${myflags%% $ifname}"
-last_flag="${myflags##* }"
-# Address the problem of having just dhcpcd_flags=wm0
-if [ "$myflags" = "$last_flag" ]; then
-	last_flag="invalidinterfacename"
-fi
-if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && 
-    ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
-then
-	pidfile=/var/run/$name-"$ifname".pid
-else
-	pidfile=/var/run/$name.pid
-fi
-unset myflags ifname last_flag
+pidfile=$(eval $command -P $myflags 2>/dev/null)
+: ${pidfile:=/var/run/$name.pid}
+unset myflags
 
 run_rc_command "$1"

Reply via email to