1
0
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:
Dan Fandrich 2017-04-27 01:24:07 +02:00
parent 3364de00f7
commit 4da846a41e
2 changed files with 13 additions and 1 deletions

View File

@ -3294,7 +3294,8 @@ AC_CHECK_FUNCS([fork \
setmode \
setrlimit \
uname \
utime
utime \
utimes
],[
],[
func="$ac_func"

View File

@ -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;