summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2017-09-14 08:53:39 -0400
committerjim-p <jimp@pfsense.org>2017-09-14 08:55:09 -0400
commit793dc52dc94978f125d0028da7539cb77dca91f4 (patch)
tree310fd56b3e565e14b341e979b5052e6c2773a67e /src/etc/inc
parent48c4a0ea0958c0820f6caab2bf5182967114ac58 (diff)
downloadpfsense-793dc52dc94978f125d0028da7539cb77dca91f4.zip
pfsense-793dc52dc94978f125d0028da7539cb77dca91f4.tar.gz
Move this file_exists test inside the dpinger status check loop and also suppress PHP errors from stream_socket_client()
Both are done to avoid a race where the status file can be missing and the status check fails, resulting in an alert/crash report. (cherry picked from commit 59104a6ff6c862482eddb9696fd8d22dec89052e)
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/gwlb.inc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc
index 9f8ca94..05a0025 100644
--- a/src/etc/inc/gwlb.inc
+++ b/src/etc/inc/gwlb.inc
@@ -323,13 +323,13 @@ function get_dpinger_status($gwname, $detailed = false) {
$proc = $running_processes[$gwname];
unset($running_processes);
- if (!file_exists($proc['socket'])) {
- log_error("dpinger: status socket {$proc['socket']} not found");
- return false;
- }
$timeoutcounter = 0;
while (true) {
- $fp = stream_socket_client("unix://{$proc['socket']}", $errno, $errstr, 10);
+ if (!file_exists($proc['socket'])) {
+ log_error("dpinger: status socket {$proc['socket']} not found");
+ return false;
+ }
+ $fp = @stream_socket_client("unix://{$proc['socket']}", $errno, $errstr, 10);
if (!$fp) {
log_error(sprintf(gettext('dpinger: cannot connect to status socket %1$s - %2$s (%3$s)'), $proc['socket'], $errstr, $errno));
return false;
OpenPOWER on IntegriCloud