diff options
author | NewEraCracker <neweracracker@gmail.com> | 2016-08-15 13:23:26 +0100 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-08-29 16:07:48 -0300 |
commit | 487599363cc43a1f4402824dbc85906b6af6a4d2 (patch) | |
tree | f28f9383a644d4e4f72abac68468f0ef2b544f6d /src/etc | |
parent | 776692947bda5c867c7f5e60550c3a508760c251 (diff) | |
download | pfsense-487599363cc43a1f4402824dbc85906b6af6a4d2.zip pfsense-487599363cc43a1f4402824dbc85906b6af6a4d2.tar.gz |
system_dhcpleases_configure() - Improve pidfile handling
1) Set the pidfile variable in the correct place.
pidfile variable is required in both 'if' and 'else' blocks.
2) Ensure pidfile is valid before sending term signal
(cherry picked from commit 4509abc380552554cbdf3f42c6783b47112f245a)
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/system.inc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 8ba9265..58ebc7a 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -477,6 +477,8 @@ function system_hosts_generate() { function system_dhcpleases_configure() { global $config, $g; + $pidfile = "{$g['varrun_path']}/dhcpleases.pid"; + /* Start the monitoring process for dynamic dhcpclients. */ if ((isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcp'])) || (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcp']))) { @@ -494,7 +496,6 @@ function system_dhcpleases_configure() { $unbound_conf = ""; } - $pidfile = "{$g['varrun_path']}/dhcpleases.pid"; if (isvalidpid($pidfile)) { /* Make sure dhcpleases is using correct unbound or dnsmasq */ $_gb = exec("/bin/pgrep -F {$pidfile} -f {$dns_pid}", $output, $retval); @@ -512,7 +513,7 @@ function system_dhcpleases_configure() { } @unlink($pidfile); mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d {$config['system']['domain']} -p {$g['varrun_path']}/{$dns_pid} {$unbound_conf} -h {$g['varetc_path']}/hosts"); - } else { + } elseif (isvalidpid($pidfile)) { sigkillbypid($pidfile, "TERM"); @unlink($pidfile); } |