Make dispatch-conf's log file have 0600 permissions.
authorJason Stubbs <jstubbs@gentoo.org>
Wed, 5 Oct 2005 15:49:25 +0000 (15:49 -0000)
committerJason Stubbs <jstubbs@gentoo.org>
Wed, 5 Oct 2005 15:49:25 +0000 (15:49 -0000)
svn path=/main/branches/2.0/; revision=2099

bin/dispatch-conf

index c1d8b700b18bde2f11679fcfba4200b6ee2a5337..bc8077a63445b376c42c36dbb158e02efffc2f78 100755 (executable)
@@ -64,9 +64,12 @@ class dispatch:
         self.options = dispatch_conf.read_config(MANDATORY_OPTS)
 
         if self.options.has_key("log-file"):
-            if os.path.exists(self.options["log-file"]):
-                shutil.copyfile(self.options["log-file"], self.options["log-file"] + '.old')
-                os.remove(self.options["log-file"])
+            if os.path.isfile(self.options["log-file"]):
+                shutil.copy(self.options["log-file"], self.options["log-file"] + '.old')
+            if os.path.isfile(self.options["log-file"]) \
+               or not os.path.exists(self.options["log-file"]):
+                open(self.options["log-file"], 'w').close() # Truncate it
+                os.chmod(self.options["log-file"], 0600)
         else:
             self.options["log-file"] = "/dev/null"