[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-35-g3633050
Andreas Beckmann
debian at abeckmann.de
Wed Jun 27 20:03:48 UTC 2012
The following commit has been merged in the develop branch:
commit 57b1d9be5a8c4e82aa7503cadeab0c4f70501fa7
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Mon Jun 25 16:59:22 2012 +0200
logdb: write content to the temporary file before linking
to catch potential write errors before creating something with the final name
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 14f7629..9c95f52 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -202,6 +202,7 @@ class LogDB:
def create(self, subdir, package, version, contents):
(fd, temp_name) = tempfile.mkstemp(dir=subdir)
+ assert os.write(fd, contents) == len(contents)
os.close(fd)
# tempfile.mkstemp sets the file mode to be readable only by owner.
@@ -217,9 +218,6 @@ class LogDB:
os.remove(temp_name)
return False
os.remove(temp_name)
- f = self.open_file(full_name, "w")
- f.write(contents)
- f.close()
self._evict(full_name)
return True
--
piuparts git repository
More information about the Piuparts-commits
mailing list