]> granicus.if.org Git - shadow/commitdiff
* lib/commonio.c: Call fsync before closing the backup file. This
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 21 Mar 2009 19:12:00 +0000 (19:12 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 21 Mar 2009 19:12:00 +0000 (19:12 +0000)
ensures that the backup file is flushed to the storage medium.

ChangeLog
lib/commonio.c

index 5000c2dc21e8ea65afc3bb51413a3e80dcd1ba33..501d783828b5542936c6f93c89b4b8c58c311ffb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-21  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * lib/commonio.c: Call fsync before closing the backup file. This
+       ensures that the backup file is flushed to the storage medium.
+
 2009-03-15  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/groupmod.c: Embed gshadow related cleanup in #ifdef
index 0e9da37f87494975e2927223a5f908a925543226..c80b9855c4b7121e5ddf6daac7b9e308adf43a71 100644 (file)
@@ -251,7 +251,8 @@ static int create_backup (const char *backup, FILE * fp)
                fclose (bkfp);
                return -1;
        }
-       if (fclose (bkfp) != 0) {
+       if (   (fsync (fileno (bkfp)) != 0)
+           || (fclose (bkfp) != 0)) {
                return -1;
        }