]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
replace_file should not fail if replaced_path does not exist.
authorDaira Hopwood <daira@jacaranda.org>
Mon, 31 Aug 2015 16:52:55 +0000 (17:52 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 31 Aug 2015 16:52:55 +0000 (17:52 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/util/fileutil.py

index 9a194e99df0df52e3f4b82e865edec5421a6b88b..2debc7f72833f61a74ceba37ed1d6a0326d415a1 100644 (file)
@@ -619,7 +619,11 @@ else:
         if not os.path.exists(replacement_path):
             raise ConflictError("Replacement file not found: %r" % (replacement_path,))
         try:
-            os.rename(replaced_path, backup_path)
+            try:
+                os.rename(replaced_path, backup_path)
+            except OSError as e:
+                if e.errno != errno.EEXIST:
+                    raise
             rename_no_overwrite(replacement_path, replaced_path)
         except EnvironmentError:
             reraise(ConflictError)