From 3adb9fdfd50d01490d1dfddcd9aeebe311c7852e Mon Sep 17 00:00:00 2001 From: Jeroen van der Ham Date: Sat, 27 Jun 2015 14:18:10 +0200 Subject: [PATCH 1/2] Remove umask changing --- SickBeard.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SickBeard.py b/SickBeard.py index 1dd4a99bb1..f529503fb0 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -94,10 +94,6 @@ def daemonize(): os.setsid() # @UndefinedVariable - only available in UNIX - # Make sure I can read my own files and shut out others - prev = os.umask(0) - os.umask(prev and int('077', 8)) - # Make the child a session-leader by detaching from the terminal try: pid = os.fork() # @UndefinedVariable - only available in UNIX From bdf057dfa3c9938a444da0a4d476def233fd3a7c Mon Sep 17 00:00:00 2001 From: Jeroen van der Ham Date: Sun, 28 Jun 2015 13:22:05 +0200 Subject: [PATCH 2/2] Added umask setting/restoring to configfiles --- lib/configobj.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/configobj.py b/lib/configobj.py index 3d343553b6..19640d4d22 100644 --- a/lib/configobj.py +++ b/lib/configobj.py @@ -2057,7 +2057,11 @@ def write(self, outfile=None, section=None): if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)): # Add the UTF8 BOM output = BOM_UTF8 + output - + + # Protect our configuration file so we can read the configuration file, and others can not. + prev = os.umask(0) + os.umask(prev and int('077', 8)) + if not output.endswith(newline): output += newline if outfile is not None: @@ -2066,6 +2070,8 @@ def write(self, outfile=None, section=None): h = open(self.filename, 'wb') h.write(output) h.close() + # Reset the umask to the original setting + os.umask(prev) def validate(self, validator, preserve_errors=False, copy=False,