--- 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));