diff options
author | Renato Botelho <renato@netgate.com> | 2017-01-11 12:13:51 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-01-11 14:46:31 -0200 |
commit | 6f7e852f94fd6dc6ecbf130fa5efcc13214fd9e6 (patch) | |
tree | f32b51b96418542fcada9714a69dfe075e737a9b /src/etc | |
parent | 2354cc09eede66a4bb2a4dca756c68842026ab73 (diff) | |
download | pfsense-6f7e852f94fd6dc6ecbf130fa5efcc13214fd9e6.zip pfsense-6f7e852f94fd6dc6ecbf130fa5efcc13214fd9e6.tar.gz |
Kill dhcpleases after we are sure we can write /etc/hosts
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/system.inc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index e7b8609..422f92e 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -499,6 +499,14 @@ function system_hosts_generate() { } } + $fd = fopen("{$g['varetc_path']}/hosts", "w"); + if (!$fd) { + log_error(gettext( + "Error: cannot open hosts file in system_hosts_generate()." + )); + return 1; + } + /* * Do not remove this because dhcpleases monitors with kqueue it needs * to be killed before writing to hosts files. @@ -508,13 +516,6 @@ function system_hosts_generate() { @unlink("{$g['varrun_path']}/dhcpleases.pid"); } - $fd = fopen("{$g['varetc_path']}/hosts", "w"); - if (!$fd) { - log_error(gettext( - "Error: cannot open hosts file in system_hosts_generate()." - )); - return 1; - } fwrite($fd, $hosts); fclose($fd); |