| Index: third_party/logilab/common/daemon.py
|
| diff --git a/third_party/logilab/common/daemon.py b/third_party/logilab/common/daemon.py
|
| index 6324b20167ee729900199ea3161dd6d0d2ef12e6..40319a43a7cabba58116feb0ca6331d25c21fd5c 100644
|
| --- a/third_party/logilab/common/daemon.py
|
| +++ b/third_party/logilab/common/daemon.py
|
| @@ -51,7 +51,7 @@ def setugid(user):
|
| os.environ['HOME'] = passwd.pw_dir
|
|
|
|
|
| -def daemonize(pidfile=None, uid=None, umask=077):
|
| +def daemonize(pidfile=None, uid=None, umask=0o77):
|
| """daemonize a Unix process. Set paranoid umask by default.
|
|
|
| Return 1 in the original process, 2 in the first fork, and None for the
|
| @@ -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)
|
|
|