summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/system.inc
diff options
context:
space:
mode:
authorNewEraCracker <neweracracker@gmail.com>2016-08-15 13:23:26 +0100
committerNewEraCracker <neweracracker@gmail.com>2016-08-20 18:56:42 +0100
commit4509abc380552554cbdf3f42c6783b47112f245a (patch)
tree6d268936f7a1cebeb5dc6972bb8fe7f9622454af /src/etc/inc/system.inc
parent68ce71f290ab1fd5f701614c7ee12cbfb2f25d4f (diff)
downloadpfsense-4509abc380552554cbdf3f42c6783b47112f245a.zip
pfsense-4509abc380552554cbdf3f42c6783b47112f245a.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
Diffstat (limited to 'src/etc/inc/system.inc')
-rw-r--r--src/etc/inc/system.inc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index b985daa..7635182 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -445,6 +445,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']))) {
@@ -462,7 +464,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);
@@ -480,7 +481,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);
}
OpenPOWER on IntegriCloud