aboutsummaryrefslogtreecommitdiffstats
path: root/libcontacts_save_contact.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcontacts_save_contact.c')
-rw-r--r--libcontacts_save_contact.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libcontacts_save_contact.c b/libcontacts_save_contact.c
index 5e27b85..b82a485 100644
--- a/libcontacts_save_contact.c
+++ b/libcontacts_save_contact.c
@@ -70,7 +70,13 @@ libcontacts_save_contact(struct libcontacts_contact *contact, const struct passw
goto fail;
}
- close(fd), fd = -1;
+ if (fsync(fd))
+ goto fail;
+ if (close(fd)) {
+ fd = -1;
+ goto fail;
+ }
+ fd = -1;
if (rename(tmppath, path))
goto fail;