diff options
author | Ermal Luçi <eri@pfsense.org> | 2010-02-03 14:57:37 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2010-02-03 14:57:37 +0000 |
commit | 920af30f8c093fa8ce878ed4401b5d752613905e (patch) | |
tree | 869858b4aa4e25aa04a501497e8795894cc6a2ce | |
parent | 17fdcb8dc3d9b9f5fb75382207c79387e8ff88ac (diff) | |
download | pfsense-920af30f8c093fa8ce878ed4401b5d752613905e.zip pfsense-920af30f8c093fa8ce878ed4401b5d752613905e.tar.gz |
Do propper checking on sasyncd to not try to start this damon uselessly.
-rw-r--r-- | etc/inc/vpn.inc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index a268808..6aa792e 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -46,9 +46,9 @@ function vpn_ipsec_failover_configure() { global $config, $g; - $sasyncd_text = ""; - if ($config['installedpackages']['sasyncd'] <> "") + if (is_array($config['installedpackages']['sasyncd'])) { + $sasyncd_text = ""; foreach ($config['installedpackages']['sasyncd']['config'] as $sasyncd) { $enabled = isset ($sasyncd['enable']); if (!$enabled) @@ -67,16 +67,15 @@ function vpn_ipsec_failover_configure() { $sasyncd_text .= "flushmode sync {$sasyncd['flushmodesync']}\n"; } - $fd = fopen("{$g['varetc_path']}/sasyncd.conf", "w"); - fwrite($fd, $sasyncd_text); - fclose($fd); - chmod("{$g['varetc_path']}/sasyncd.conf", 0600); + file_put_contents("{$g['varetc_path']}/sasyncd.conf", $sasyncd_text); + chmod("{$g['varetc_path']}/sasyncd.conf", 0600); - if(is_process_running("sasyncd")) - mwexec("killall sasyncd", true); + if(is_process_running("sasyncd")) + mwexec("killall sasyncd", true); - /* launch sasyncd, oh wise one */ - mwexec_bg("/usr/local/sbin/sasyncd -d -v -v -v"); + /* launch sasyncd, oh wise one */ + mwexec_bg("/usr/local/sbin/sasyncd -d -v -v -v"); + } } function find_last_gif_device() { |