From d56e6d08bc80da1dc3497aa87a0a36bacf51a950 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sat, 21 Mar 2009 20:40:52 +0000 Subject: [PATCH] * debian/patches/401_cppw_src.dpatch: Call fsync before closing the backup file descriptor. This ensures that the backup file will be available on the storage medium. --- debian/changelog | 3 +++ debian/patches/401_cppw_src.dpatch | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8ae37aad..665d65cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -53,6 +53,9 @@ shadow (1:4.1.3-1) unstable; urgency=low * debian/patches/507_32char_grnames.dpatch: Patch removed. Replaced by the --with-group-name-max-length=32 configure option. * debian/patches/592_manpages_typos: No more needed. + * debian/patches/401_cppw_src.dpatch: Call fsync before closing the backup + file descriptor. This ensures that the backup file will be available on + the storage medium. -- Nicolas FRANCOIS (Nekral) Sat, 14 Mar 2009 18:44:29 +0100 diff --git a/debian/patches/401_cppw_src.dpatch b/debian/patches/401_cppw_src.dpatch index 9c2caec2..87093c0e 100755 --- a/debian/patches/401_cppw_src.dpatch +++ b/debian/patches/401_cppw_src.dpatch @@ -9,7 +9,7 @@ Index: shadow-4.1.0/src/cppw.c =================================================================== --- /dev/null +++ shadow-4.1.0/src/cppw.c -@@ -0,0 +1,198 @@ +@@ -0,0 +1,199 @@ +/* + cppw, cpgr copy with locking given file over the password or group file + with -s will copy with locking given file over shadow or gshadow file @@ -86,7 +86,8 @@ Index: shadow-4.1.0/src/cppw.c + unlink(backup); + return -1; + } -+ if (fclose(bkfp)) { ++ if ( (fsync (bkfp) != 0) ++ || (fclose(bkfp) != 0)) { + unlink(backup); + return -1; + }