aboutsummaryrefslogtreecommitdiff
path: root/libsylph/prefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/prefs.c')
-rw-r--r--libsylph/prefs.c10
1 files changed, 8 insertions, 2 deletions
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");