From e2ae0ce54d4c6920c47962d4923428a114daabbf Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 9 May 2018 06:03:19 +0000 Subject: [PATCH] system: small tweak for #2396 --- src/etc/inc/gwlb.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index bf4942a95..ab20e9216 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -1121,13 +1121,16 @@ function running_dpinger_processes() { $result = array(); - /* XXX this is untrue, pid file may be stale? */ $pidfiles = glob('/var/run/dpinger_*.pid'); if ($pidfiles === false) { return $result; } foreach ($pidfiles as $pidfile) { + if (!isvalidpid($pidfile)) { + /* spare caller from trying to read a stale socket later on */ + continue; + } if (preg_match('/^dpinger_(.+)\.pid$/', basename($pidfile), $matches)) { $socket_file = preg_replace('/\.pid$/', '.sock', $pidfile); $result[$matches[1]] = array('socket' => $socket_file, 'pidfile' => $pidfile);