mirror of git://git.musl-libc.org/musl
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...
This commit is contained in:
parent
4d4f13e581
commit
c37afdfdf3
|
@ -1,7 +1,14 @@
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
int utime(const char *path, const struct utimbuf *times)
|
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue