Simplify permission logic for emerge.log.
authorZac Medico <zmedico@gentoo.org>
Thu, 22 Jun 2006 19:11:20 +0000 (19:11 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 22 Jun 2006 19:11:20 +0000 (19:11 -0000)
svn path=/main/trunk/; revision=3609

bin/emerge

index 0b4f5b10d919b43414024dc1b6aa1e8de805701b..579ecf1d43f41a1809cc3213cc32d1a1c3eebfe6 100755 (executable)
@@ -465,13 +465,11 @@ def emergelog(mystr,short_msg=None):
                else:
                        xtermTitle(mystr)
        try:
-               #seems odd opening a file each write...
-               if not os.path.exists("/var/log/emerge.log"):
-                       mylogfile=open("/var/log/emerge.log", "w")
-                       os.chmod("/var/log/emerge.log", S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-                       os.chown("/var/log/emerge.log", portage.portage_uid, portage.portage_gid)
-               else:
-                       mylogfile=open("/var/log/emerge.log", "a")
+               file_path = "/var/log/emerge.log"
+               mylogfile = open(file_path, "a")
+               portage_util.apply_secpass_permissions(file_path,
+                       uid=portage.portage_uid, gid=portage.portage_gid,
+                       mode=0660)
 
                l=portage_locks.lockfile(mylogfile)
                # seek because we may have gotten held up by the lock.