summaryrefslogtreecommitdiff
path: root/src/tool_operate.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-04-27 01:24:07 +0200
committerDan Fandrich <dan@coneharvesters.com>2017-04-27 22:34:12 +0200
commit4da846a41ed19f2a81357d30cf210bf4616a8798 (patch)
tree76ca9e039f5155116a209075a283cd123a1a5bb1 /src/tool_operate.c
parent3364de00f75ef1bc9d2e70a74e63090d583e048d (diff)
downloadcurl-4da846a41ed19f2a81357d30cf210bf4616a8798.tar.gz
tool_operate: use utimes instead of obsolescent utime when available
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r--src/tool_operate.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 724826c8e..5a129bd34 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -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;