From d96bb2868d5613850cef0817569115ea92046d51 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 22 Dec 2022 11:42:44 +0100 Subject: [PATCH] Assume struct stat has st_atim and st_mtim fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That's required by POSIX.1-2008. Link: Cc: Christian Göttsche Cc: Iker Pedrosa Cc: Mike Frysinger Cc: Serge Hallyn Signed-off-by: Alejandro Colomar --- configure.ac | 4 ---- libmisc/copydir.c | 18 ------------------ 2 files changed, 22 deletions(-) diff --git a/configure.ac b/configure.ac index 51bb20ce..3165da78 100644 --- a/configure.ac +++ b/configure.ac @@ -54,10 +54,6 @@ AC_CHECK_FUNCS(arc4random_buf futimes \ AC_SYS_LARGEFILE dnl Checks for typedefs, structures, and compiler characteristics. -AC_CHECK_MEMBERS([struct stat.st_atim]) -AC_CHECK_MEMBERS([struct stat.st_atimensec]) -AC_CHECK_MEMBERS([struct stat.st_mtim]) -AC_CHECK_MEMBERS([struct stat.st_mtimensec]) AC_STRUCT_TM AC_CHECK_MEMBERS([struct utmp.ut_type, diff --git a/libmisc/copydir.c b/libmisc/copydir.c index 5e569b8f..c1740e58 100644 --- a/libmisc/copydir.c +++ b/libmisc/copydir.c @@ -419,29 +419,11 @@ static int copy_entry (const struct path_info *src, const struct path_info *dst, if (fstatat(src->dirfd, src->name, &sb, AT_SYMLINK_NOFOLLOW) == -1) { /* If we cannot stat the file, do not care. */ } else { -#ifdef HAVE_STRUCT_STAT_ST_ATIM mt[0].tv_sec = sb.st_atim.tv_sec; mt[0].tv_nsec = sb.st_atim.tv_nsec; -#else /* !HAVE_STRUCT_STAT_ST_ATIM */ - mt[0].tv_sec = sb.st_atime; -# ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC - mt[0].tv_nsec = sb.st_atimensec; -# else /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */ - mt[0].tv_nsec = 0; -# endif /* !HAVE_STRUCT_STAT_ST_ATIMENSEC */ -#endif /* !HAVE_STRUCT_STAT_ST_ATIM */ -#ifdef HAVE_STRUCT_STAT_ST_MTIM mt[1].tv_sec = sb.st_mtim.tv_sec; mt[1].tv_nsec = sb.st_mtim.tv_nsec; -#else /* !HAVE_STRUCT_STAT_ST_MTIM */ - mt[1].tv_sec = sb.st_mtime; -# ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC - mt[1].tv_nsec = sb.st_mtimensec; -# else /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */ - mt[1].tv_nsec = 0; -# endif /* !HAVE_STRUCT_STAT_ST_MTIMENSEC */ -#endif /* !HAVE_STRUCT_STAT_ST_MTIM */ if (S_ISDIR (sb.st_mode)) { err = copy_dir (src, dst, reset_selinux, &sb, mt,