diff options
author | Warren Baker <warren@decoy.co.za> | 2011-06-21 19:44:05 +0200 |
---|---|---|
committer | Warren Baker <warren@decoy.co.za> | 2011-06-21 19:44:05 +0200 |
commit | 1015b3a966c39d5cf1bd58e4f6225fffd14091c1 (patch) | |
tree | 4bf9c69d2296a273d10680c08831fb5d1c72fcfd /etc/inc/util.inc | |
parent | 490615d3bc187e108cbdc8d13f30c9dda6edfbd5 (diff) | |
download | pfsense-1015b3a966c39d5cf1bd58e4f6225fffd14091c1.zip pfsense-1015b3a966c39d5cf1bd58e4f6225fffd14091c1.tar.gz |
If no event_address in globals.inc specified assume the default. Also fixed whitespaces.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index b165fec..9906ae5 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -139,6 +139,9 @@ function unlock($cfglckkey = 0) { function send_event($cmd) { global $g; + if(!isset($g['event_address'])) + $g['event_address'] = "unix:///var/run/check_reload_status"; + $try = 0; while ($try < 3) { $fd = @fsockopen($g['event_address']); @@ -156,20 +159,23 @@ function send_event($cmd) { } function send_multiple_events($cmds) { - global $g; + global $g; + if(!isset($g['event_address'])) + $g['event_address'] = "unix:///var/run/check_reload_status"; + if (!is_array($cmds)) return; - $fd = fsockopen($g['event_address']); - if ($fd) { + $fd = fsockopen($g['event_address']); + if ($fd) { foreach ($cmds as $cmd) { - fwrite($fd, $cmd); - $resp = fread($fd, 4096); - if ($resp != "OK\n") - log_error("send_event: sent {$cmd} got {$resp}"); + fwrite($fd, $cmd); + $resp = fread($fd, 4096); + if ($resp != "OK\n") + log_error("send_event: sent {$cmd} got {$resp}"); } - fclose($fd); - } + fclose($fd); + } } function refcount_init($reference) { |