[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Cope with systems that lack os.O_SYNC



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.seul.org:/tmp/cvs-serv11522/lib/mixminion

Modified Files:
	HashLog.py 
Log Message:
Cope with systems that lack os.O_SYNC

Index: HashLog.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/HashLog.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- HashLog.py	2 Dec 2002 20:18:44 -0000	1.12
+++ HashLog.py	3 Dec 2002 00:40:26 -0000	1.13
@@ -17,6 +17,7 @@
 # FFFF two-copy journaling to protect against catastrophic failure that
 # FFFF underlying DB code can't handle.
 
+_JOURNAL_OPEN_MODE = os.O_WRONLY|os.O_CREAT|getattr(os,'O_SYNC',0)
 class HashLog:
     """A HashLog is a file containing a list of message digests that we've
        already processed.
@@ -73,7 +74,7 @@
 	    f.close()
 
 	self.journalFile = os.open(self.journalFileName, 
-		    os.O_WRONLY|os.O_CREAT|os.O_APPEND|os.O_SYNC, 0700)
+		    _JOURNAL_OPEN_MODE|os.O_APPEND, 0700)
 
     def seenHash(self, hash):
         """Return true iff 'hash' has been logged before."""
@@ -100,7 +101,7 @@
             self.log.sync()
 	os.close(self.journalFile)
 	self.journalFile = os.open(self.journalFileName,
-		os.O_WRONLY|os.O_CREAT|os.O_TRUNC|os.O_SYNC, 0700)
+		   _JOURNAL_OPEN_MODE|os.O_TRUNC, 0700)
 	self.journal = {}
 
     def close(self):