start script: create lock and pid files non-world-writeable

This commit is contained in:
David Anderson 2017-01-27 12:12:49 -08:00
parent e93e436b5a
commit 1274dbe2cb
1 changed files with 2 additions and 1 deletions

View File

@ -284,7 +284,7 @@ def double_fork():
# Decouple from parent environment. # Decouple from parent environment.
os.chdir("/") os.chdir("/")
os.umask(0) os.umask(02)
os.setsid() os.setsid()
# Do second fork. # Do second fork.
@ -312,6 +312,7 @@ def is_pid_running(pid):
locks = [] locks = []
def lock_file(filename): def lock_file(filename):
global locks global locks
os.umask(02)
file = open(filename,'w') file = open(filename,'w')
locks.append(file) locks.append(file)
try: try: