From 2c902cc2887340adb6ca7ac6b4b922b52438920f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 30 Aug 2023 07:16:49 -0700 Subject: [PATCH] maint: rely on Gnulib fdatasync * 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 | 16 ---------------- src/dd.c | 4 ---- src/shred.c | 2 -- 3 files changed, 22 deletions(-) diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4 index 0da7ae143e..84c1209af9 100644 --- a/m4/jm-macros.m4 +++ b/m4/jm-macros.m4 @@ -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], diff --git a/src/dd.c b/src/dd.c index b50b8411d4..198d4800ca 100644 --- a/src/dd.c +++ b/src/dd.c @@ -73,10 +73,6 @@ 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 \ { \ diff --git a/src/shred.c b/src/shred.c index a5da4e038e..b2cf7220e4 100644 --- a/src/shred.c +++ b/src/shred.c @@ -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; -- 2.47.2