summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2011-01-23 18:37:31 +0000
committeragc <agc@pkgsrc.org>2011-01-23 18:37:31 +0000
commitf5404a820b828d189f2df4c4925b8189a9f4d458 (patch)
tree44f76120c336189fe291caa871810181f424aaa6 /net
parent838d56dff009d45e8fc50e1ce3a5b6b694c9ab91 (diff)
downloadpkgsrc-f5404a820b828d189f2df4c4925b8189a9f4d458.tar.gz
Handle the case where tm_year is a long variable, from Benny Siegert
and Thorsten Glaser. Part of the MirBSD support changes.
Diffstat (limited to 'net')
-rw-r--r--net/libfetch/files/ftp.c8
-rw-r--r--net/libfetch/files/http.c6
2 files changed, 7 insertions, 7 deletions
diff --git a/net/libfetch/files/ftp.c b/net/libfetch/files/ftp.c
index cd6bee13f40..b60618edb86 100644
--- a/net/libfetch/files/ftp.c
+++ b/net/libfetch/files/ftp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ftp.c,v 1.36 2010/08/20 17:56:49 joerg Exp $ */
+/* $NetBSD: ftp.c,v 1.37 2011/01/23 18:37:31 agc Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2008, 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
@@ -464,7 +464,7 @@ ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
{
char *ln;
const char *filename;
- int filenamelen, type;
+ int filenamelen, type, year;
struct tm tm;
time_t t;
int e;
@@ -516,13 +516,13 @@ ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
return (-1);
}
if (sscanf(ln, "%04d%02d%02d%02d%02d%02d",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
+ &year, &tm.tm_mon, &tm.tm_mday,
&tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
ftp_seterr(FTP_PROTOCOL_ERROR);
return (-1);
}
tm.tm_mon--;
- tm.tm_year -= 1900;
+ tm.tm_year = year - 1900;
tm.tm_isdst = -1;
t = timegm(&tm);
if (t == (time_t)-1)
diff --git a/net/libfetch/files/http.c b/net/libfetch/files/http.c
index 4028178c754..c6d0d80ccfc 100644
--- a/net/libfetch/files/http.c
+++ b/net/libfetch/files/http.c
@@ -1,4 +1,4 @@
-/* $NetBSD: http.c,v 1.29 2010/01/24 19:10:35 joerg Exp $ */
+/* $NetBSD: http.c,v 1.30 2011/01/23 18:37:31 agc Exp $ */
/*-
* Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2003 Thomas Klausner <wiz@NetBSD.org>
@@ -797,9 +797,9 @@ set_if_modified_since(conn_t *conn, time_t last_modified)
struct tm tm;
char buf[80];
gmtime_r(&last_modified, &tm);
- snprintf(buf, sizeof(buf), "%.3s, %02d %.3s %4d %02d:%02d:%02d GMT",
+ snprintf(buf, sizeof(buf), "%.3s, %02d %.3s %4ld %02d:%02d:%02d GMT",
weekdays + tm.tm_wday * 3, tm.tm_mday, months + tm.tm_mon * 3,
- tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ (long)(tm.tm_year + 1900), tm.tm_hour, tm.tm_min, tm.tm_sec);
http_cmd(conn, "If-Modified-Since: %s\r\n", buf);
}