summaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-24 10:55:58 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-24 10:55:58 -0400
commitc37afdfdf393261e18364aed52571d0a5b011044 (patch)
tree602ffd6cae562ac255f4fa0c84c5183fd7e612e3 /src/time
parent4d4f13e5813f3b1f7e7fd43cfe1a5da641dca96c (diff)
downloadmusl-c37afdfdf393261e18364aed52571d0a5b011044.tar.gz
musl-c37afdfdf393261e18364aed52571d0a5b011044.tar.bz2
musl-c37afdfdf393261e18364aed52571d0a5b011044.tar.xz
musl-c37afdfdf393261e18364aed52571d0a5b011044.zip
linux deprecated SYS_utime on some archs, so use SYS_utimes instead
the old code could be kept for cases where SYS_utime is available, but it's not really worth the ifdef ugliness. and better to avoid deprecated stuff just in case the kernel devs ever get crazy enough to start removing it from archs where it was part of the ABI and breaking static bins...
Diffstat (limited to 'src/time')
-rw-r--r--src/time/utime.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/time/utime.c b/src/time/utime.c
index 856315b4..b2b5741b 100644
--- a/src/time/utime.c
+++ b/src/time/utime.c
@@ -1,7 +1,14 @@
#include <utime.h>
+#include <sys/time.h>
#include "syscall.h"
int utime(const char *path, const struct utimbuf *times)
{
- return syscall(SYS_utime, path, times);
+ if (times) {
+ struct timeval tv[2] = {
+ { .tv_sec = times->actime },
+ { .tv_sec = times->modtime } };
+ return syscall(SYS_utimes, path, tv);
+ }
+ return syscall(SYS_utimes, path, 0);
}