1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
From: Robert Luberda <robert@debian.org>
Date: Thu, 28 Jan 2016 23:04:33 +0100
Subject: 32 Fix FTBFS on Hurd
Fallback to a previously version of alter() function if UTIME_OMIT
is not defined (which happens most probably on Hurd only, see #762677).
---
aux.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/aux.c b/aux.c
index 521f97d..44c95d7 100644
--- a/aux.c
+++ b/aux.c
@@ -328,6 +328,7 @@ unstack(void)
* Touch the indicated file.
* This is nifty for the shell.
*/
+#ifdef UTIME_OMIT
void
alter(char *name)
{
@@ -339,6 +340,25 @@ alter(char *name)
(void)utimensat(AT_FDCWD, name, ts, 0);
}
+#else
+#warning "UTIME_OMIT not defined, falling back to the old version of alter() function"
+#include <sys/time.h>
+void
+alter(char *name)
+{
+ struct stat sb;
+ struct timeval tv[2];
+
+ if (stat(name, &sb))
+ return;
+ (void) gettimeofday(&tv[0], (struct timezone *)0);
+ tv[0].tv_sec++;
+ tv[1].tv_sec = sb.st_mtime;
+ tv[1].tv_usec = 0;
+ (void)utimes(name, tv);
+}
+#endif
+
/*
* Examine the passed line buffer and
* return true if it is all blanks and tabs.
|