im.pidgin.pidgin: fbe5808a8fa8c35651a2920d4aa62f1781d51246

elb at pidgin.im elb at pidgin.im
Thu Nov 8 19:40:51 EST 2007


-----------------------------------------------------------------
Revision: fbe5808a8fa8c35651a2920d4aa62f1781d51246
Ancestor: 7d51d92656a386ecd5d02f6b22db9f7153ca157b
Author: elb at pidgin.im
Date: 2007-11-08T23:47:22
Branch: im.pidgin.pidgin

Modified files:
        libpurple/util.c

ChangeLog: 

jtb indirectly points out that we need a fflush() before the fsync(),
which I forgot.

-------------- next part --------------
============================================================
--- libpurple/util.c	4abf7c727e91c922c3279113da230950ffbb9d24
+++ libpurple/util.c	f0d44d62c931286cc6cb2be18c3e04b01cc42469
@@ -2602,6 +2602,13 @@ purple_util_write_data_to_file_absolute(
 	/* Apparently XFS (and possibly other filesystems) do not
 	 * guarantee that file data is flushed before file metadata,
 	 * so this procedure is insufficient without some flushage. */
+	if (fflush(file) < 0) {
+		purple_debug_error("util", "Error flushing %s: %s\n",
+				   filename_temp, g_strerror(errno));
+		g_free(filename_temp);
+		fclose(file);
+		return FALSE;
+	}
 	if (fsync(fileno(file)) < 0) {
 		purple_debug_error("util", "Error syncing file contents for %s: %s\n",
 				   filename_temp, g_strerror(errno));


More information about the Commits mailing list