]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: rely on Gnulib fdatasync
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Aug 2023 14:16:49 +0000 (07:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 31 Aug 2023 03:32:13 +0000 (20:32 -0700)
* m4/jm-macros.m4: Remove fdatasync-related code,
as Gnulib now does this.
* src/dd.c (fdatasync) [!HAVE_FDATASYNC]:
* src/shred.c (dosync) [!HAVE_FDATASYNC]: Rely on Gnulib fdatasync.

m4/jm-macros.m4
src/dd.c
src/shred.c

index 0da7ae143eb69824629957ab864de350728f746a..84c1209af99fc628a465e7f567518131511d8053 100644 (file)
@@ -94,22 +94,6 @@ AC_DEFUN([coreutils_MACROS],
   dnl This can't use AC_REQUIRE; I'm not quite sure why.
   cu_PREREQ_STAT_PROG
 
-  # for dd.c and shred.c
-  #
-  # Use fdatasync only if declared.  On MacOS X 10.7, fdatasync exists but
-  # is not declared, and is ineffective.
-  LIB_FDATASYNC=
-  AC_SUBST([LIB_FDATASYNC])
-  AC_CHECK_DECLS_ONCE([fdatasync])
-  if test $ac_cv_have_decl_fdatasync = yes; then
-    coreutils_saved_libs=$LIBS
-    AC_SEARCH_LIBS([fdatasync], [rt posix4],
-                   [test "$ac_cv_search_fdatasync" = "none required" ||
-                    LIB_FDATASYNC=$ac_cv_search_fdatasync])
-    AC_CHECK_FUNCS([fdatasync])
-    LIBS=$coreutils_saved_libs
-  fi
-
   # Check whether libcap is usable -- for ls --color support
   LIB_CAP=
   AC_ARG_ENABLE([libcap],
index b50b8411d4c3d18184841b8aca98861335d63a76..198d4800ca6c4544b2916c7c0b441f21d40645b7 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
    and would interfere with our use of that name, below.  */
 #undef O_NOCACHE
 
-#if ! HAVE_FDATASYNC
-# define fdatasync(fd) (errno = ENOSYS, -1)
-#endif
-
 #define output_char(c)                         \
   do                                           \
     {                                          \
index a5da4e038e370ccced0146b88afcce6878bfc593..b2cf7220e43007c4b3d734871d23a29548095713 100644 (file)
@@ -300,7 +300,6 @@ dosync (int fd, char const *qname)
 {
   int err;
 
-#if HAVE_FDATASYNC
   if (fdatasync (fd) == 0)
     return 0;
   err = errno;
@@ -310,7 +309,6 @@ dosync (int fd, char const *qname)
       errno = err;
       return -1;
     }
-#endif
 
   if (fsync (fd) == 0)
     return 0;