tool_filetime: make -z work with file dates before 1970

Fixes #11785
Reported-by: Harry Sintonen
Closes #11786
This commit is contained in:
Daniel Stenberg 2023-09-01 23:46:22 +02:00
parent 5949369c9f
commit dffd996e3b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 17 additions and 14 deletions

View file

@ -2648,11 +2648,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->condtime = (curl_off_t)curl_getdate(nextarg, &now);
if(-1 == config->condtime) {
/* now let's see if it is a file name to get the time from instead! */
curl_off_t filetime = getfiletime(nextarg, global);
if(filetime >= 0) {
curl_off_t filetime;
rc = getfiletime(nextarg, global, &filetime);
if(!rc)
/* pull the time out from the file */
config->condtime = filetime;
}
else {
/* failed, remove time condition */
config->timecond = CURL_TIMECOND_NONE;