1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

time_t-fixes: remove typecasts to 'long' for info.filetime

They're now wrong.

Reported-by: Michael Kaufmann

Closes #2277
This commit is contained in:
Daniel Stenberg 2018-02-01 00:24:19 +01:00
parent 9409d0c26c
commit ddd31dc5dd
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
5 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -403,12 +403,12 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
/* we could stat it, then read out the size */ /* we could stat it, then read out the size */
expected_size = statbuf.st_size; expected_size = statbuf.st_size;
/* and store the modification time */ /* and store the modification time */
data->info.filetime = (long)statbuf.st_mtime; data->info.filetime = statbuf.st_mtime;
fstated = TRUE; fstated = TRUE;
} }
if(fstated && !data->state.range && data->set.timecondition) { if(fstated && !data->state.range && data->set.timecondition) {
if(!Curl_meets_timecondition(data, (time_t)data->info.filetime)) { if(!Curl_meets_timecondition(data, data->info.filetime)) {
*done = TRUE; *done = TRUE;
return CURLE_OK; return CURLE_OK;
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -2061,7 +2061,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
"%04d%02d%02d %02d:%02d:%02d GMT", "%04d%02d%02d %02d:%02d:%02d GMT",
year, month, day, hour, minute, second); year, month, day, hour, minute, second);
/* now, convert this into a time() value: */ /* now, convert this into a time() value: */
data->info.filetime = (long)curl_getdate(timebuf, &secs); data->info.filetime = curl_getdate(timebuf, &secs);
} }
#ifdef CURL_FTP_HTTPSTYLE_HEAD #ifdef CURL_FTP_HTTPSTYLE_HEAD
@ -2073,7 +2073,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
data->set.get_filetime && data->set.get_filetime &&
(data->info.filetime >= 0) ) { (data->info.filetime >= 0) ) {
char headerbuf[128]; char headerbuf[128];
time_t filetime = (time_t)data->info.filetime; time_t filetime = data->info.filetime;
struct tm buffer; struct tm buffer;
const struct tm *tm = &buffer; const struct tm *tm = &buffer;

View File

@ -3692,7 +3692,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
k->timeofdoc = curl_getdate(k->p + strlen("Last-Modified:"), k->timeofdoc = curl_getdate(k->p + strlen("Last-Modified:"),
&secs); &secs);
if(data->set.get_filetime) if(data->set.get_filetime)
data->info.filetime = (long)k->timeofdoc; data->info.filetime = k->timeofdoc;
} }
else if((checkprefix("WWW-Authenticate:", k->p) && else if((checkprefix("WWW-Authenticate:", k->p) &&
(401 == k->httpcode)) || (401 == k->httpcode)) ||

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2017 Red Hat, Inc. * Copyright (C) 2017 - 2018 Red Hat, Inc.
* *
* Authors: Nikos Mavrogiannopoulos, Tomas Mraz, Stanislav Zidek, * Authors: Nikos Mavrogiannopoulos, Tomas Mraz, Stanislav Zidek,
* Robert Kolcun, Andreas Schneider * Robert Kolcun, Andreas Schneider
@ -1046,7 +1046,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
attrs = sftp_stat(sshc->sftp_session, protop->path); attrs = sftp_stat(sshc->sftp_session, protop->path);
if(attrs != 0) { if(attrs != 0) {
data->info.filetime = (long)attrs->mtime; data->info.filetime = attrs->mtime;
sftp_attributes_free(attrs); sftp_attributes_free(attrs);
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -1627,7 +1627,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break; break;
} }
if(rc == 0) { if(rc == 0) {
data->info.filetime = (long)attrs.mtime; data->info.filetime = attrs.mtime;
} }
state(conn, SSH_SFTP_TRANS_INIT); state(conn, SSH_SFTP_TRANS_INIT);