summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-03-01 10:34:19 +0000
committerLars Wirzenius <liw@liw.fi>2012-03-01 10:34:19 +0000
commit35503e914f01d4efefc61e1c1cb37e038ee07ec6 (patch)
treeca7e6e621c9c35b7f9ba89feac3b1b9394f00553
parent3f1084fff5b7bd5d7c50b2a2178df8caea249db8 (diff)
downloadobnam-35503e914f01d4efefc61e1c1cb37e038ee07ec6.tar.gz
Fix write_file for LocalFS
The previous code had, I think, been moved from generic VFS code, where it had to deal with SFTP limitations. Since the code is now LocalFS specific, removing the documented race condition can only be regarded as overdue. (Meanwhile, the actual SFTP code seems to work better.)
-rw-r--r--obnamlib/vfs_local.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py
index ea608e8a..56cd1c8f 100644
--- a/obnamlib/vfs_local.py
+++ b/obnamlib/vfs_local.py
@@ -247,14 +247,8 @@ class LocalFS(obnamlib.VirtualFileSystem):
try:
os.link(tempname, path)
except OSError, e: # pragma: no cover
- # sshfs does not implement link(2), so we fudge it here.
- # FIXME: This has race conditions and should be made atomic.
- if e.errno != errno.ENOSYS:
- os.remove(tempname)
- raise
- if os.path.exists(path):
- raise OSError(errno.EEXIST, os.strerror(errno.EEXIST), path)
- os.rename(tempname, path)
+ os.remove(tempname)
+ raise
os.remove(tempname)
def overwrite_file(self, pathname, contents, make_backup=True):