From: Robin H. Johnson Date: Sun, 1 Nov 2009 18:39:58 +0000 (+0100) Subject: Use utimes(3) instead of utime(3) to avoid truncating timestamps X-Git-Tag: v3.0pre0~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=237bee66157f59be586fa1f558804c92860c0ead;p=thirdparty%2Fccache.git Use utimes(3) instead of utime(3) to avoid truncating timestamps See . --- diff --git a/ccache.c b/ccache.c index 4760a0ab9..2bafb9731 100644 --- a/ccache.c +++ b/ccache.c @@ -505,8 +505,13 @@ static void from_cache(int first) /* update timestamps for LRU cleanup also gives output_file a sensible mtime when hard-linking (for make) */ +#ifdef HAVE_UTIMES + utimes(hashname, NULL); + utimes(stderr_file, NULL); +#else utime(hashname, NULL); utime(stderr_file, NULL); +#endif if (strcmp(output_file, "/dev/null") == 0) { ret = 0; diff --git a/ccache.h b/ccache.h index 5e8946957..2ce9cb3a6 100644 --- a/ccache.h +++ b/ccache.h @@ -22,6 +22,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif #ifdef ENABLE_ZLIB #include diff --git a/config.h.in b/config.h.in index 2fde92065..69190d5c3 100644 --- a/config.h.in +++ b/config.h.in @@ -22,6 +22,9 @@ /* Define to 1 if you have the `getpwuid' function. */ #undef HAVE_GETPWUID +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -37,6 +40,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH @@ -66,6 +72,9 @@ /* 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_TIME_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -75,6 +84,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `utimes' function. */ +#undef HAVE_UTIMES + /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF diff --git a/configure.in b/configure.in index 4db700995..74d6efbfa 100644 --- a/configure.in +++ b/configure.in @@ -35,10 +35,11 @@ AC_HEADER_DIRENT AC_HEADER_TIME AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h) +AC_CHECK_HEADERS(ctype.h strings.h stdlib.h string.h pwd.h sys/time.h) AC_CHECK_FUNCS(realpath snprintf vsnprintf vasprintf asprintf mkstemp) AC_CHECK_FUNCS(gethostname getpwuid) +AC_CHECK_FUNCS(utimes) AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [ AC_TRY_COMPILE(