]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Use utimes(3) instead of utime(3) to avoid truncating timestamps
authorRobin H. Johnson <robbat2@gentoo.org>
Sun, 1 Nov 2009 18:39:58 +0000 (19:39 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 5 Jan 2010 17:53:00 +0000 (18:53 +0100)
See <http://bugs.gentoo.org/136233>.

ccache.c
ccache.h
config.h.in
configure.in

index 4760a0ab9e2ed99b4969399d2b514eeadc8f80e7..2bafb9731f5afe8d88339de47f42ddf743acf17f 100644 (file)
--- 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;
index 5e89469573bf451b2db39e7f2947d60f23c33c4e..2ce9cb3a62536a9e1348bcc313243cfffe17f92f 100644 (file)
--- a/ccache.h
+++ b/ccache.h
@@ -22,6 +22,9 @@
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 
 #ifdef ENABLE_ZLIB
 #include <zlib.h>
index 2fde920655a2e4a12f271e9387aada178c09ea32..69190d5c35f7df5355d898c956ba42e5ed1ead51 100644 (file)
@@ -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 <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
@@ -37,6 +40,9 @@
 /* Define to 1 if you have the <pwd.h> header file. */
 #undef HAVE_PWD_H
 
+/* Define to 1 if you have the <pwd.h> 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 <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
@@ -75,6 +84,9 @@
 /* Define to 1 if you have the <unistd.h> 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
 
index 4db700995187b96cad4a97da59a07b8f3b47021a..74d6efbfafbc30e1dc03fb6be004a75031c0d32b 100644 (file)
@@ -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(