[jhbuild] packagedb: Do fsync() of the packagedb before renaming
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] packagedb: Do fsync() of the packagedb before renaming
- Date: Mon, 18 Jul 2011 13:35:23 +0000 (UTC)
commit 00ddf8a47e4ffdf05f2a119c3c2d82d43de1470c
Author: Colin Walters <walters verbum org>
Date: Mon Jul 18 09:26:15 2011 -0400
packagedb: Do fsync() of the packagedb before renaming
This should be more robust against potential failure.
jhbuild/utils/packagedb.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/utils/packagedb.py b/jhbuild/utils/packagedb.py
index 083e727..b8db0e7 100644
--- a/jhbuild/utils/packagedb.py
+++ b/jhbuild/utils/packagedb.py
@@ -125,6 +125,8 @@ class PackageDB:
tmp_dbfile.close()
os.unlink(tmp_dbfile_path)
raise
+ tmp_dbfile.flush()
+ os.fsync(tmp_dbfile.fileno())
tmp_dbfile.close()
os.rename(tmp_dbfile_path, self.dbfile)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]