From d0240722220985b4ca879c6caa1ca927d5309588 Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 17 Mar 2009 08:56:27 +0000 Subject: abort if fsync() fails. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2122 ee746299-78ed-0310-b773-934348b2243d --- libsylph/prefs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libsylph') diff --git a/libsylph/prefs.c b/libsylph/prefs.c index 07078d52..56a2eda6 100644 --- a/libsylph/prefs.c +++ b/libsylph/prefs.c @@ -397,8 +397,14 @@ gint prefs_file_close(PrefFile *pfile) goto finish; } #if HAVE_FSYNC - if ((fd = fileno(fp)) >= 0) - fsync(fd); + if ((fd = fileno(fp)) >= 0) { + if (fsync(fd) < 0) { + FILE_OP_ERROR(tmppath, "fsync"); + fclose(fp); + ret = -1; + goto finish; + } + } #endif if (fclose(fp) == EOF) { FILE_OP_ERROR(tmppath, "fclose"); -- cgit v1.2.3