summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/gwlb.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:53:39 -0400
commit59104a6ff6c862482eddb9696fd8d22dec89052e (patch)
tree7efd3ab3c1905884539d4196b5138b1ac3d2d60a /src/etc/inc/gwlb.inc
parent271fc45ede9e1d39050255780cb886e89bead987 (diff)
downloadpfsense-59104a6ff6c862482eddb9696fd8d22dec89052e.zip
pfsense-59104a6ff6c862482eddb9696fd8d22dec89052e.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.
Diffstat (limited to 'src/etc/inc/gwlb.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