diff options
author | Ermal Luçi <eri@pfsense.org> | 2010-03-09 12:45:27 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2010-03-09 12:45:27 +0000 |
commit | 575a42f58c4ce54c8774b875187fd63f4173f673 (patch) | |
tree | 9f62396e055d74c2e3a99f218da23ccdec188649 /etc/inc/growl.class | |
parent | 621500884f61785fdd63ce5190fa776285e703c9 (diff) | |
download | pfsense-575a42f58c4ce54c8774b875187fd63f4173f673.zip pfsense-575a42f58c4ce54c8774b875187fd63f4173f673.tar.gz |
Add some more error checking to not have issues as reported on http://forum.pfsense.org/index.php/topic,23435.0.html
Diffstat (limited to 'etc/inc/growl.class')
-rw-r--r-- | etc/inc/growl.class | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/etc/inc/growl.class b/etc/inc/growl.class index aa35533..883ec8b 100644 --- a/etc/inc/growl.class +++ b/etc/inc/growl.class @@ -77,20 +77,26 @@ { if(function_exists('socket_create') && function_exists('socket_sendto')) { - $sck = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); - socket_sendto($sck, $data, strlen($data), 0x100, $this->address, $this->port); - return true; + $sck = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + if ($sck) { + socket_sendto($sck, $data, strlen($data), 0x100, $this->address, $this->port); + return true; + } } elseif(function_exists('fsockopen')) { - $fp = fsockopen('udp://' . $this->address, $this->port); - fwrite($fp, $data); - fclose($fp); - return true; + if ($this->address) { + $fp = @fsockopen('udp://' . $this->address, $this->port); + if ($fp) { + fwrite($fp, $data); + fclose($fp); + return true; + } + } } return false; } } -?>
\ No newline at end of file +?> |