Write pid before resetting umask
authorkaliko <efrim@azylum.org>
Sun, 22 May 2011 18:07:14 +0000 (20:07 +0200)
committerkaliko <efrim@azylum.org>
Sun, 22 May 2011 18:07:14 +0000 (20:07 +0200)
src/daemon.py

index 787cb65..7489233 100644 (file)
@@ -59,7 +59,6 @@ class Daemon(object):
             sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror))
             sys.exit(1)
 
-        self.write_pid()
         # redirect standard file descriptors
         sys.stdout.flush()
         sys.stderr.flush()
@@ -114,6 +113,7 @@ class Daemon(object):
             sys.stderr.write(message % self.pidfile)
             sys.exit(1)
 
+        self.write_pid()
         # Start the daemon
         self.daemonize()
         self.run()