[PATCH 13/13] Use a different lock file than the old offlineimap

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Nov 24 09:56:50 GMT 2010


The old offlineimap never ever  deleted the lock file, so our new offlineimap fails thinking it is still being locked. Use a different lock file location. NEVER RUN the old and the new offlineimap at the same time now.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/init.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/offlineimap/init.py b/offlineimap/init.py
index d06e766..70db2a2 100644
--- a/offlineimap/init.py
+++ b/offlineimap/init.py
@@ -43,15 +43,16 @@ class OfflineImap:
 
     def lock(self):
         """Create lock file and exit if not possible"""
+        lockfile = os.path.join(self._config.getmetadatadir(), "locked")
         try:
-            lockfd = os.open(self._config.getmetadatadir() + "/lock", os.O_CREAT|os.O_EXCL)
+            lockfd = os.open( lockfile, os.O_CREAT|os.O_EXCL)
             os.close(lockfd)
+            self._lockfile = lockfile
         except OSError as e:
             if e.errno == 17:
                 #File exists
                 OfflineImap.ui.locked()
                 OfflineImap.ui.terminate(1)
-        self._lockfile = self._config.getmetadatadir() + "/lock"
 
     def unlock(self):
         """Delete lockfile if existing."""
-- 
1.7.1





More information about the OfflineIMAP-project mailing list