<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 012f6a2be96dd337abc101c98e3bce137af1679c Mon Sep 17 00:00:00 2001
From: Slaven Rezic &lt;slaven.rezic@idealo.de&gt;
Date: Wed, 29 Oct 2014 15:59:24 +0100
Subject: [PATCH] pid check works now for all users

Running "status" used to show the wrong result if the daemon was
started for a different user. According to perlipc.pod it's best to
check for $!{EPERM} after a failed kill 0 =&gt; ...

The pid_running() function was also simplified to call kill 0 =&gt; ...
only once, the 2nd call was actually redundant.
---
 lib/Daemon/Control.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/Daemon/Control.pm b/lib/Daemon/Control.pm
index 2d3dbb3..ab95a51 100644
--- a/lib/Daemon/Control.pm
+++ b/lib/Daemon/Control.pm
@@ -358,7 +358,7 @@ sub pid_running {
     $pid ||= $self-&gt;read_pid;
 
     return 0 unless $self-&gt;pid &gt;= 1;
-    return 0 unless kill 0, $self-&gt;pid;
+    return 0 unless (kill(0, $self-&gt;pid) || $!{EPERM});
 
     if ( $self-&gt;scan_name ) {
         open my $lf, "-|", "ps", "-p", $self-&gt;pid, "-o", "command="
@@ -367,9 +367,9 @@ sub pid_running {
             return 1 if $line =~ $self-&gt;scan_name;
         }
         return 0;
+    } else {
+	return 1;
     }
-    # Scan name wasn't used, testing normal PID.
-    return kill 0, $self-&gt;pid;
 }
 
 sub process_running {
-- 
1.8.3.4

</pre></body></html>