]> granicus.if.org Git - shadow/commitdiff
* libmisc/copydir.c, configure.in: Check for the presence of
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 7 Sep 2008 00:05:38 +0000 (00:05 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 7 Sep 2008 00:05:38 +0000 (00:05 +0000)
st_mtim and st_mtimensec, as for st_atim and st_atimensec.

ChangeLog
configure.in
libmisc/copydir.c

index 7a5099f1bc23c0e13981e231bf42b4376d9a81a5..d0fc82772c14ad7b611d506a2f5c7a871fbf79f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-07  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/copydir.c, configure.in: Check for the presence of
+       st_mtim and st_mtimensec, as for st_atim and st_atimensec.
+
 2008-09-07  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/gpasswd.c: Document the long options in the usage.
index ebbb6d5c335011c27e28f9f3102ddd16b70e2360..8da687a4e6f50708c7583bc394a9b917ffac5e3d 100644 (file)
@@ -54,6 +54,8 @@ AC_HEADER_STAT
 AC_CHECK_MEMBERS([struct stat.st_rdev])
 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_HEADER_TIME
 AC_STRUCT_TM
 
index cdd2037037d1eb74f886baf7f75efb6721d7df41..a9aec98aec2cf906c03a0c7425704d62f1627a62 100644 (file)
@@ -288,19 +288,26 @@ static int copy_entry (const char *src, const char *dst,
        if (LSTAT (src, &sb) == -1) {
                /* If we cannot stat the file, do not care. */
        } else {
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
+#ifdef HAVE_STRUCT_STAT_ST_ATIM
                mt[0].tv_sec  = sb.st_atim.tv_sec;
                mt[0].tv_usec = sb.st_atim.tv_nsec / 1000;
-               mt[1].tv_sec  = sb.st_mtim.tv_sec;
-               mt[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
 #else
                mt[0].tv_sec  = sb.st_atime;
-               mt[1].tv_sec  = sb.st_mtime;
 #ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
                mt[0].tv_usec = sb.st_atimensec / 1000;
-               mt[1].tv_usec = sb.st_mtimensec / 1000;
 #else
                mt[0].tv_usec = 0;
+#endif
+#endif
+
+#ifdef HAVE_STRUCT_STAT_ST_MTIM
+               mt[1].tv_sec  = sb.st_mtim.tv_sec;
+               mt[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
+#else
+               mt[1].tv_sec  = sb.st_mtime;
+#ifdef HAVE_STRUCT_STAT_ST_MTIMENSEC
+               mt[1].tv_usec = sb.st_mtimensec / 1000;
+#else
                mt[1].tv_usec = 0;
 #endif
 #endif