Assume struct stat has st_atim and st_mtim fields
That's required by POSIX.1-2008. Link: <https://github.com/shadow-maint/shadow/pull/600> Cc: Christian Göttsche <cgzones@googlemail.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
5d7a3b80e9
commit
d96bb2868d
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user