]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Assume fsync(2) exists
authorAlejandro Colomar <alx@kernel.org>
Fri, 2 Dec 2022 21:32:59 +0000 (22:32 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 15 Dec 2022 22:22:05 +0000 (16:22 -0600)
It is required by POSIX.1-2001.

Cc: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
lib/commonio.c

index 56fa3fb48ed285af217b91d13489750adf2d1d76..b3d0048851e30066a613f632e15f75da759482eb 100644 (file)
@@ -45,7 +45,7 @@ AC_CHECK_HEADERS(crypt.h utmp.h \
 dnl shadow now uses the libc's shadow implementation
 AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
 
-AC_CHECK_FUNCS(arc4random_buf fsync futimes \
+AC_CHECK_FUNCS(arc4random_buf futimes \
        getentropy getrandom getspnam getusershell \
        getutent initgroups lckpwdf lutimes \
        setgroups updwtmp updwtmpx innetgr getpwnam_r \
index 7234e613fb717abe54bfdcfc7fe6238ed670357e..119d506e799337df586e74eac81d0b386dfa00fa 100644 (file)
@@ -986,13 +986,11 @@ int commonio_close (struct commonio_db *db)
        if (fflush (db->fp) != 0) {
                errors++;
        }
-#ifdef HAVE_FSYNC
+
        if (fsync (fileno (db->fp)) != 0) {
                errors++;
        }
-#else                          /* !HAVE_FSYNC */
-       sync ();
-#endif                         /* !HAVE_FSYNC */
+
        if (fclose (db->fp) != 0) {
                errors++;
        }