From: Brian Warner <warner@lothar.com>
Date: Thu, 19 Feb 2009 06:13:42 +0000 (-0700)
Subject: crawler: use fileutil.move_info_place in preference to our own version
X-Git-Tag: allmydata-tahoe-1.4.0~187
X-Git-Url: https://git.rkrishnan.org/specifications/install.html?a=commitdiff_plain;h=dfd72c64836f7e2b3153f6c77885cdef800eb093;p=tahoe-lafs%2Ftahoe-lafs.git

crawler: use fileutil.move_info_place in preference to our own version
---

diff --git a/src/allmydata/storage/crawler.py b/src/allmydata/storage/crawler.py
index e79ba94d..e4f8622c 100644
--- a/src/allmydata/storage/crawler.py
+++ b/src/allmydata/storage/crawler.py
@@ -1,8 +1,9 @@
 
-import sys, os, time, struct, pickle
+import os, time, struct, pickle
 from twisted.internet import reactor
 from twisted.application import service
 from allmydata.storage.server import si_b2a
+from allmydata.util import fileutil
 
 class TimeSliceExceeded(Exception):
     pass
@@ -89,10 +90,7 @@ class ShareCrawler(service.MultiService):
         f = open(tmpfile, "wb")
         pickle.dump(state, f)
         f.close()
-        if "win32" in sys.platform.lower():
-            # sigh, stupid windows can't use this technique
-            os.unlink(self.statefile)
-        os.rename(tmpfile, self.statefile)
+        fileutil.move_into_place(tmpfile, self.statefile)
 
     def startService(self):
         self.load_state()