lock file around chown/chmod
authorAlec Warner <antarus@gentoo.org>
Thu, 18 Jan 2007 06:59:50 +0000 (06:59 -0000)
committerAlec Warner <antarus@gentoo.org>
Thu, 18 Jan 2007 06:59:50 +0000 (06:59 -0000)
svn path=/main/trunk/; revision=5700

pym/portage_news.py

index a0cb885aee88568d634e556d6bfbd5c4f90f561d..bd2a4078962869697508c131436e880b36cd5e09 100644 (file)
@@ -114,11 +114,14 @@ class NewsManager(object):
                unreadfile = os.path.join( self.UNREAD_PATH, "news-"+ repoid +".unread" )
                # Set correct permissions on the news-repoid.unread file
                try:
-                       apply_permissions( filename=unreadfile, 
+                       lock = lockfile(unreadfile)
+                       apply_permissions( filename=unreadfile,
                                uid=self.config["PORTAGE_INST_UID"], gid=portage_gid, mode=664 )
                except FileNotFound:
                        pass # It may not exist yet, thats ok.
-               
+               finally:
+                       if lock:
+                               unlockfile(lock)
                if update:
                        self.updateItems( repoid )