/offlineimap/head: changeset 273

Handle uidvalidity file in an atomic fashion
This commit is contained in:
jgoerzen 2002-10-21 22:40:31 +01:00
parent 09a2ac9221
commit 4ab770bb3d
2 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ offlineimap (3.99.2) unstable; urgency=low
50 debug messages, whether or not debugging was enabled for this 50 debug messages, whether or not debugging was enabled for this
session. This way, even unexpected and non-repeatable errors stand session. This way, even unexpected and non-repeatable errors stand
a chance of getting a more detailed log. a chance of getting a more detailed log.
* Handle uidvalidity file in an atomic fashion. CLoses: #165600.
-- John Goerzen <jgoerzen@complete.org> Tue, 15 Oct 2002 12:35:42 -0500 -- John Goerzen <jgoerzen@complete.org> Tue, 15 Oct 2002 12:35:42 -0500

View File

@ -62,9 +62,10 @@ class MaildirFolder(BaseFolder):
return self.uidvalidity return self.uidvalidity
def saveuidvalidity(self, newval): def saveuidvalidity(self, newval):
file = open(self.uidfilename, "wt") file = open(self.uidfilename + ".tmp", "wt")
file.write("%d\n" % newval) file.write("%d\n" % newval)
file.close() file.close()
os.rename(self.uidfilename + ".tmp", self.uidfilename)
self.uidvalidity = newval self.uidvalidity = newval
def isuidvalidityok(self, remotefolder): def isuidvalidityok(self, remotefolder):