[maemo-commits] [maemo-commits] r17831 - in projects/haf/trunk/glib: . glib

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Mar 27 12:21:35 EET 2009
Author: timj
Date: 2009-03-27 12:21:33 +0200 (Fri, 27 Mar 2009)
New Revision: 17831

Modified:
   projects/haf/trunk/glib/ChangeLog
   projects/haf/trunk/glib/glib/gfileutils.c
Log:
2009-03-27 11:14:15  Tim Janik  <timj at lanedo.com>

        * glib/gfileutils.c (write_to_temp_file): issue fdatasync() before
        closing the file to work around file systems with writeback behaviour.



Modified: projects/haf/trunk/glib/ChangeLog
===================================================================
--- projects/haf/trunk/glib/ChangeLog	2009-03-27 09:56:39 UTC (rev 17830)
+++ projects/haf/trunk/glib/ChangeLog	2009-03-27 10:21:33 UTC (rev 17831)
@@ -1,3 +1,8 @@
+2009-03-27 11:14:15  Tim Janik  <timj at lanedo.com>
+
+	* glib/gfileutils.c (write_to_temp_file): issue fdatasync() before
+	closing the file to work around file systems with writeback behaviour.
+
 2009-03-12  Claudio Saavedra  <csaavedra at igalia.com>
 
 	* debian/changelog: Update for 2.18.1-1maemo3

Modified: projects/haf/trunk/glib/glib/gfileutils.c
===================================================================
--- projects/haf/trunk/glib/glib/gfileutils.c	2009-03-27 09:56:39 UTC (rev 17830)
+++ projects/haf/trunk/glib/glib/gfileutils.c	2009-03-27 10:21:33 UTC (rev 17831)
@@ -995,7 +995,14 @@
     }
    
   errno = 0;
+#ifdef MAEMO_CHANGES
+  /* introduce a write-barrier for file contents before close()/rename()
+   * to work around file systems with writeback behaviour like UBIFS.
+   */
+  if (fdatasync (fileno (file)) < 0 || fclose (file) == EOF)
+#else /* !MAEMO_CHANGES */
   if (fclose (file) == EOF)
+#endif /* MAEMO_CHANGES */
     { 
       save_errno = 0;
       


More information about the maemo-commits mailing list