From e86f9f34e67c89123b747524d7e67dd70175d3d4 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 21 Nov 2012 23:22:21 -0600 Subject: [PATCH] Only access struct stat.mtim if available --- config.h.in | 173 --------------------------------------------------- configure.ac | 6 ++ src/modify.c | 6 ++ 3 files changed, 12 insertions(+), 173 deletions(-) delete mode 100644 config.h.in diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 7b52011b..00000000 --- a/config.h.in +++ /dev/null @@ -1,173 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to 1 if including assertions. */ -#undef ENABLE_ASSERTIONS - -/* Define to 1 if supporting custom memory allocation functions */ -#undef ENABLE_CUSTOM_MEMORY_ALLOCATOR - -/* Define to 1 if including lots of debug messages. */ -#undef ENABLE_DEBUG - -/* Define to 1 if including error messages */ -#undef ENABLE_ERROR_MESSAGES - -/* Define to 1 if including even more debug messages. */ -#undef ENABLE_MORE_DEBUG - -/* Define to 1 if including support for multithreaded compression */ -#undef ENABLE_MULTITHREADED_COMPRESSION - -/* Define to 1 if using vectorized implementation of SHA1 */ -#undef ENABLE_SSSE3_SHA1 - -/* Define to 1 to verify compressed data */ -#undef ENABLE_VERIFY_COMPRESSION - -/* Define to 1 if using the xattr interface to WIM alternate data streams */ -#undef ENABLE_XATTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ATTR_XATTR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_BYTESWAP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if you have the `flock' function. */ -#undef HAVE_FLOCK - -/* Define if you have the iconv() function and it works. */ -#undef HAVE_ICONV - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `ntfs-3g' library (-lntfs-3g). */ -#undef HAVE_LIBNTFS_3G - -/* Define to 1 if you have the `lutimes' function. */ -#undef HAVE_LUTIMES - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_BYTEORDER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `utime' function. */ -#undef HAVE_UTIME - -/* Define to 1 if you have the `utimensat' function. */ -#undef HAVE_UTIMENSAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define as const if the declaration of iconv() needs const. */ -#undef ICONV_CONST - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if using FUSE. */ -#undef WITH_FUSE - -/* Define to 1 if using libcrypto SHA1 */ -#undef WITH_LIBCRYPTO - -/* Define to 1 to enable support for NTFS-specific information */ -#undef WITH_NTFS_3G - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif diff --git a/configure.ac b/configure.ac index c35b62ab..799cc911 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,12 @@ AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \ sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \ errno.h attr/xattr.h utime.h sys/file.h]) +AC_CHECK_MEMBER([struct stat.st_mtim], + [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1], + [Define to 1 if nanosecond precision timestamps are + supported])], + [], + [[#include ]]) AM_ICONV if test "x$am_cv_func_iconv" != "xyes"; then diff --git a/src/modify.c b/src/modify.c index ee6edb17..fbbf1bf2 100644 --- a/src/modify.c +++ b/src/modify.c @@ -167,9 +167,15 @@ static int build_dentry_tree(struct dentry **root_ret, inode = root->d_inode; +#ifdef HAVE_STAT_NANOSECOND_PRECISION inode->creation_time = timespec_to_wim_timestamp(&root_stbuf.st_mtim); inode->last_write_time = timespec_to_wim_timestamp(&root_stbuf.st_mtim); inode->last_access_time = timespec_to_wim_timestamp(&root_stbuf.st_atim); +#else + inode->creation_time = unix_timestamp_to_wim(root_stbuf.st_mtime); + inode->last_write_time = unix_timestamp_to_wim(root_stbuf.st_mtime); + inode->last_access_time = unix_timestamp_to_wim(root_stbuf.st_atime); +#endif if (sizeof(ino_t) >= 8) inode->ino = (u64)root_stbuf.st_ino; else -- 2.43.0