From: Markos Chandras <[email protected]>

Signed-off-by: Markos Chandras <[email protected]>
---
 libc/sysdeps/linux/common/utime.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/libc/sysdeps/linux/common/utime.c 
b/libc/sysdeps/linux/common/utime.c
index c9fd1bf..75d4d2c 100644
--- a/libc/sysdeps/linux/common/utime.c
+++ b/libc/sysdeps/linux/common/utime.c
@@ -8,10 +8,30 @@
  */
 
 #include <sys/syscall.h>
+#include <fcntl.h>
+#include <stddef.h>
 #include <utime.h>
 
 
-#ifdef __NR_utime
+#if defined(__NR_utimensat) && !defined(__NR_utime)
+int utime(const char *file, const struct utimbuf *times)
+{
+       struct timespec tspecs[2], *ts;
+
+       if (times) {
+               ts = tspecs;
+               ts[0].tv_sec = times->actime;
+               ts[0].tv_nsec = 0;
+               ts[1].tv_sec = times->modtime;
+               ts[1].tv_nsec = 0;
+       } else {
+               ts = NULL;
+       }
+
+       return utimensat(AT_FDCWD, file, ts, 0);
+}
+
+#elif defined(__NR_utime)
 _syscall2(int, utime, const char *, file, const struct utimbuf *, times)
 #else
 #include <stdlib.h>
-- 
1.8.0


_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to