[jhbuild] Fallback to os.fsync if os.fdatasync is not available (GNOME bug 660527)



commit 27dea76b539f630fd30e340dca5fc16039c0e8e9
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Sun Oct 2 22:22:43 2011 +0200

    Fallback to os.fsync if os.fdatasync is not available (GNOME bug 660527)

 jhbuild/utils/packagedb.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/utils/packagedb.py b/jhbuild/utils/packagedb.py
index f610e71..e45b58c 100644
--- a/jhbuild/utils/packagedb.py
+++ b/jhbuild/utils/packagedb.py
@@ -108,7 +108,10 @@ class PackageEntry:
         if self.manifest is not None:
             fd = file(os.path.join(self.manifests_dir, self.package + '.tmp'), 'w')
             fd.write('\n'.join(self.manifest))
-            os.fdatasync(fd.fileno())
+            if hasattr(os, 'fdatasync'):
+                os.fdatasync(fd.fileno())
+            else:
+                os.fsync(fd.fileno())
             fd.close()
             os.rename(os.path.join(self.manifests_dir, self.package + '.tmp'),
                       os.path.join(self.manifests_dir, self.package))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]