aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-02-07 15:00:48 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-02-07 15:00:48 +0100
commit54d9f060b4b0a8fb5fa006813e4db1ca5c1a07e8 (patch)
tree119331774fece19f0d5b727c1be50184b87298df /lib/ftp.c
parent2cacd82661b4a46ea52a23099ce0b23046a1f172 (diff)
Curl_gmtime: added a portable gmtime
Instead of polluting many places with #ifdefs, we create a single place for this function, and also check return code properly so that a NULL pointer returned won't cause problems.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 518969a98..af6b4ad88 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1841,14 +1841,14 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
ftpc->file &&
data->set.get_filetime &&
(data->info.filetime>=0) ) {
- struct tm *tm;
time_t filetime = (time_t)data->info.filetime;
-#ifdef HAVE_GMTIME_R
struct tm buffer;
- tm = (struct tm *)gmtime_r(&filetime, &buffer);
-#else
- tm = gmtime(&filetime);
-#endif
+ const struct tm *tm = &buffer;
+
+ result = Curl_gmtime(filetime, &buffer);
+ if(result)
+ return result;
+
/* format: "Tue, 15 Nov 1994 12:45:26" */
snprintf(buf, BUFSIZE-1,
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",