--- /etc/rc.d/dhclient.orig 2019-11-01 05:27:17.000000000 +0100 +++ /etc/rc.d/dhclient 2020-06-26 13:29:24.636146000 +0200 @@ -10,15 +10,17 @@ . /etc/network.subr ifn="$2" name="dhclient" desc="Dynamic Host Configuration Protocol (DHCP) client" rcvar= -pidfile="/var/run/dhclient/${name}.${ifn}.pid" +piddir=/var/run/dhclient +piddir_mode=0750 +pidfile="$piddir/${name}.${ifn}.pid" start_precmd="dhclient_prestart" stop_precmd="dhclient_pre_check" # rc_force check can only be done at the run_rc_command # time, so we're testing it in the pre* hooks. dhclient_pre_check() { @@ -32,14 +34,21 @@ fi exit 1 fi } dhclient_prestart() { + local dir + + for dir in ${piddir}; do + debug "checking $dir" + [ -d ${dir} ] || mkdir ${dir} + chmod $piddir_mode ${dir} + done dhclient_pre_check # Interface-specific flags (see rc.subr for $flags setting) specific=$(get_if_var $ifn dhclient_flags_IF) if [ -z "$flags" -a -n "$specific" ]; then rc_flags=$specific fi