jtb indirectly points out that we need a fflush() before the fsync(),

Thu, 08 Nov 2007 23:47:22 +0000

author
Ethan Blanton <elb@pidgin.im>
date
Thu, 08 Nov 2007 23:47:22 +0000
changeset 21441
eab0555e2eab
parent 21438
fae2a1b4647d
child 21444
818bb018e14c

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

libpurple/util.c file | annotate | diff | comparison | revisions
--- a/libpurple/util.c	Thu Nov 08 19:50:22 2007 +0000
+++ b/libpurple/util.c	Thu Nov 08 23:47:22 2007 +0000
@@ -2602,6 +2602,13 @@
 	/* 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));

mercurial