killdaemons: prevent killing all user processes by bad pid file
When I was fixing the test-gpg issue, I noticed gpg-connect-agent could print
"-1" as a server pid if command was wrong. I'm not pretty sure but nobody
would want to kill their running applications by mistake.
--- a/tests/killdaemons.py Wed Aug 17 20:56:12 2016 +0900
+++ b/tests/killdaemons.py Thu Aug 18 18:43:48 2016 +0900
@@ -82,7 +82,11 @@
for line in fp:
try:
pid = int(line)
+ if pid <= 0:
+ raise ValueError
except ValueError:
+ logfn('# Not killing daemon process %s - invalid pid'
+ % line.rstrip())
continue
kill(pid, logfn, tryhard)
fp.close()