fix pidfile handling
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Apr 2017 00:46:54 +0000 (01:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 10 Apr 2017 00:46:54 +0000 (01:46 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
hippotatd

index 834dc5d..123943a 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -400,12 +400,12 @@ def daemonise():
     if grandchildpid:
       # we are the intermediate child
       if opts.pidfile is not None:
-        print(grandchildpid, file=pfh)
-        pfh.close()
+        print(grandchildpid, file=pidfile_h)
+        pidfile_h.close()
       os._exit(0)
 
-    mypid = os.getpid()
-    pfh.close()
+    if opts.pidfile is not None:
+      pidfile_h.close()
                                                                         
     logger = subprocess.Popen(['logger','-d',
                                '-t','hippotat(stderr)',