mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
tool_operate: use utimes instead of obsolescent utime when available
This commit is contained in:
parent
3364de00f7
commit
4da846a41e
@ -3294,7 +3294,8 @@ AC_CHECK_FUNCS([fork \
|
||||
setmode \
|
||||
setrlimit \
|
||||
uname \
|
||||
utime
|
||||
utime \
|
||||
utimes
|
||||
],[
|
||||
],[
|
||||
func="$ac_func"
|
||||
|
@ -231,6 +231,17 @@ static void setfiletime(long filetime, const char *filename,
|
||||
"CreateFile failed: GetLastError %u\n",
|
||||
filetime, GetLastError());
|
||||
}
|
||||
|
||||
#elif defined(HAVE_UTIMES)
|
||||
struct timeval times[2];
|
||||
times[0].tv_sec = times[1].tv_sec = filetime;
|
||||
times[0].tv_usec = times[1].tv_usec = 0;
|
||||
if(utimes(filename, times)) {
|
||||
fprintf(error_stream,
|
||||
"Failed to set filetime %ld on outfile: errno %d\n",
|
||||
filetime, errno);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_UTIME)
|
||||
struct utimbuf times;
|
||||
times.actime = (time_t)filetime;
|
||||
|
Loading…
Reference in New Issue
Block a user