[Xfce4-commits] r29651 - in xfconf/trunk: . xfconfd

Brian Tarricone kelnos at xfce.org
Thu Mar 12 00:35:59 CET 2009


Author: kelnos
Date: 2009-03-11 23:35:58 +0000 (Wed, 11 Mar 2009)
New Revision: 29651

Modified:
   xfconf/trunk/NEWS
   xfconf/trunk/configure.ac.in
   xfconf/trunk/xfconfd/xfconf-backend-perchannel-xml.c
Log:
be a bit safer when writing out channel files

Modified: xfconf/trunk/NEWS
===================================================================
--- xfconf/trunk/NEWS	2009-03-11 18:00:30 UTC (rev 29650)
+++ xfconf/trunk/NEWS	2009-03-11 23:35:58 UTC (rev 29651)
@@ -1,3 +1,10 @@
+Xfce 4.6.1
+==========
+
+  * Be a bit safer when writing out channel xml files: flush data to disk
+    using fdatasync()/fsync() before renaming over the old file.
+
+
 Xfce 4.6.0
 ==========
 

Modified: xfconf/trunk/configure.ac.in
===================================================================
--- xfconf/trunk/configure.ac.in	2009-03-11 18:00:30 UTC (rev 29650)
+++ xfconf/trunk/configure.ac.in	2009-03-11 23:35:58 UTC (rev 29651)
@@ -13,7 +13,7 @@
 m4_define([xfconf_version_micro], [0])
 m4_define([xfconf_version_nano], [])
 m4_define([xfconf_version_build], [r at REVISION@])
-m4_define([xfconf_version_tag], [])
+m4_define([xfconf_version_tag], [svn])
 m4_define([xfconf_version], [xfconf_version_major().xfconf_version_minor().xfconf_version_micro()ifelse(xfconf_version_nano(), [], [], [.xfconf_version_nano()])ifelse(xfconf_version_tag(), [svn], [xfconf_version_tag()-xfconf_version_build()], [xfconf_version_tag()])])
 
 dnl init autoconf
@@ -45,7 +45,7 @@
                   sys/stat.h sys/time.h sys/types.h sys/wait.h \
                   unistd.h])
 dnl AC_CHECK_FUNCS([fdwalk getdtablesize setlocale setsid sysconf])
-AC_CHECK_FUNCS([setlocale])
+AC_CHECK_FUNCS([fdatasync fsync setlocale])
 
 dnl version information
 XFCONF_VERSION=xfconf_version

Modified: xfconf/trunk/xfconfd/xfconf-backend-perchannel-xml.c
===================================================================
--- xfconf/trunk/xfconfd/xfconf-backend-perchannel-xml.c	2009-03-11 18:00:30 UTC (rev 29650)
+++ xfconf/trunk/xfconfd/xfconf-backend-perchannel-xml.c	2009-03-11 23:35:58 UTC (rev 29651)
@@ -1,7 +1,7 @@
 /*
  *  xfconf
  *
- *  Copyright (c) 2007 Brian Tarricone <bjt23 at cornell.edu>
+ *  Copyright (c) 2007-2009 Brian Tarricone <bjt23 at cornell.edu>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -1934,6 +1934,19 @@
     if(fputs("</channel>\n", fp) == EOF)
         goto out;
 
+    if(fflush(fp))
+        goto out;
+
+#if defined(HAVE_FDATASYNC)
+    if(fdatasync(fileno(fp)))
+        goto out;
+#elif defined(HAVE_FSYNC)
+    if(fsync(fileno(fp)))
+        goto out;
+#else
+    sync();
+#endif
+
     if(fclose(fp)) {
         fp = NULL;
         goto out;




More information about the Xfce4-commits mailing list