summaryrefslogtreecommitdiff
path: root/src/tool_filetime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_filetime.c')
-rw-r--r--src/tool_filetime.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/tool_filetime.c b/src/tool_filetime.c
index 29c1e481d..8907bcda6 100644
--- a/src/tool_filetime.c
+++ b/src/tool_filetime.c
@@ -32,8 +32,7 @@
#endif
/* Returns 0 on success, non-zero on file problems */
-int getfiletime(const char *filename, struct GlobalConfig *global,
- curl_off_t *stamp)
+int getfiletime(const char *filename, curl_off_t *stamp)
{
int rc = 1;
@@ -56,21 +55,21 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
| ((curl_off_t)ft.dwHighDateTime) << 32;
if(converted < 116444736000000000)
- warnf(global, "Failed to get filetime: underflow");
+ warnf("Failed to get filetime: underflow");
else {
*stamp = (converted - 116444736000000000) / 10000000;
rc = 0;
}
}
else {
- warnf(global, "Failed to get filetime: "
+ warnf("Failed to get filetime: "
"GetFileTime failed: GetLastError %u",
(unsigned int)GetLastError());
}
CloseHandle(hfile);
}
else if(GetLastError() != ERROR_FILE_NOT_FOUND) {
- warnf(global, "Failed to get filetime: "
+ warnf("Failed to get filetime: "
"CreateFile failed: GetLastError %u",
(unsigned int)GetLastError());
}
@@ -81,14 +80,13 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
rc = 0;
}
else
- warnf(global, "Failed to get filetime: %s", strerror(errno));
+ warnf("Failed to get filetime: %s", strerror(errno));
#endif
return rc;
}
#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || defined(_WIN32)
-void setfiletime(curl_off_t filetime, const char *filename,
- struct GlobalConfig *global)
+void setfiletime(curl_off_t filetime, const char *filename)
{
if(filetime >= 0) {
/* Windows utime() may attempt to adjust the Unix GMT file time by a daylight
@@ -101,7 +99,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
/* 910670515199 is the maximum Unix filetime that can be used as a
Windows FILETIME without overflow: 30827-12-31T23:59:59. */
if(filetime > 910670515199) {
- warnf(global, "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+ warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on outfile: overflow", filetime);
curlx_unicodefree(tchar_filename);
return;
@@ -119,14 +117,14 @@ void setfiletime(curl_off_t filetime, const char *filename,
ft.dwLowDateTime = (DWORD)(converted & 0xFFFFFFFF);
ft.dwHighDateTime = (DWORD)(converted >> 32);
if(!SetFileTime(hfile, NULL, &ft, &ft)) {
- warnf(global, "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+ warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on outfile: SetFileTime failed: GetLastError %u",
filetime, (unsigned int)GetLastError());
}
CloseHandle(hfile);
}
else {
- warnf(global, "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+ warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on outfile: CreateFile failed: GetLastError %u",
filetime, (unsigned int)GetLastError());
}
@@ -136,7 +134,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
times[0].tv_sec = times[1].tv_sec = (time_t)filetime;
times[0].tv_usec = times[1].tv_usec = 0;
if(utimes(filename, times)) {
- warnf(global, "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+ warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on '%s': %s", filetime, filename, strerror(errno));
}
@@ -145,7 +143,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
times.actime = (time_t)filetime;
times.modtime = (time_t)filetime;
if(utime(filename, &times)) {
- warnf(global, "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+ warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on '%s': %s", filetime, filename, strerror(errno));
}
#endif