use write_atomic for the counter file
authorZac Medico <zmedico@gentoo.org>
Thu, 9 Feb 2006 04:25:56 +0000 (04:25 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 9 Feb 2006 04:25:56 +0000 (04:25 -0000)
svn path=/main/trunk/; revision=2686

pym/portage.py

index 339cd2e429caf1cfdfa1b2860f1debff76aab23a..dd7775a5d302de91585cb4ce797fc3be46faa721 100644 (file)
@@ -4142,12 +4142,7 @@ class dbapi:
                        #increment counter
                        counter += 1
                        # update new global counter file
-                       newcpath=cpath+".new"
-                       newcfile=open(newcpath,"w")
-                       newcfile.write(str(counter))
-                       newcfile.close()
-                       # now move global counter file into place
-                       os.rename(newcpath,cpath)
+                       write_atomic(cpath, str(counter))
                return counter
 
        def invalidentry(self, mypath):