diff options
author | Julien Cristau <julien.cristau@logilab.fr> | 2014-11-28 14:13:54 +0100 |
---|---|---|
committer | Julien Cristau <julien.cristau@logilab.fr> | 2014-11-28 14:13:54 +0100 |
commit | 6da786adbb6f7ad3e2d8bd31db6151778a08685b (patch) | |
tree | 397261e3a007e8e099a0a0cf05d342ff558e64eb | |
parent | adabb02f93efa946e245c68c34281216e07fabbc (diff) | |
download | logilab-common-6da786adbb6f7ad3e2d8bd31db6151778a08685b.tar.gz |
[daemon] change umask after creating pid file
No reason to hide the pid file / dir behind restrictive permissions.
-rw-r--r-- | daemon.py | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -71,9 +71,6 @@ def daemonize(pidfile=None, uid=None, umask=077): return 2 # move to the root to avoit mount pb os.chdir('/') - # set umask if specified - if umask is not None: - os.umask(umask) # redirect standard descriptors null = os.open('/dev/null', os.O_RDWR) for i in range(3): @@ -95,7 +92,9 @@ def daemonize(pidfile=None, uid=None, umask=077): f = file(pidfile, 'w') f.write(str(os.getpid())) f.close() - os.chmod(pidfile, 0644) + # set umask if specified + if umask is not None: + os.umask(umask) # change process uid if uid: setugid(uid) |