pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/libfetch libfetch-2.39: Improve date parsing
details: https://anonhg.NetBSD.org/pkgsrc/rev/6981e3c721f0
branches: trunk
changeset: 338576:6981e3c721f0
user: joerg <joerg%pkgsrc.org@localhost>
date: Tue Aug 27 19:24:04 2019 +0000
description:
libfetch-2.39: Improve date parsing
diffstat:
net/libfetch/Makefile | 4 ++--
net/libfetch/files/http.c | 15 ++++++++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r b6275a7e26fb -r 6981e3c721f0 net/libfetch/Makefile
--- a/net/libfetch/Makefile Tue Aug 27 17:23:48 2019 +0000
+++ b/net/libfetch/Makefile Tue Aug 27 19:24:04 2019 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.60 2017/09/07 08:01:47 wiz Exp $
+# $NetBSD: Makefile,v 1.61 2019/08/27 19:24:04 joerg Exp $
-DISTNAME= libfetch-2.38
+DISTNAME= libfetch-2.39
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
diff -r b6275a7e26fb -r 6981e3c721f0 net/libfetch/files/http.c
--- a/net/libfetch/files/http.c Tue Aug 27 17:23:48 2019 +0000
+++ b/net/libfetch/files/http.c Tue Aug 27 19:24:04 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: http.c,v 1.40 2016/10/21 11:51:18 jperkin Exp $ */
+/* $NetBSD: http.c,v 1.41 2019/08/27 19:24:04 joerg Exp $ */
/*-
* Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2003 Thomas Klausner <wiz%NetBSD.org@localhost>
@@ -526,14 +526,23 @@
static int
http_parse_mtime(const char *p, time_t *mtime)
{
- char locale[64], *r;
struct tm tm;
+ char *r;
- strncpy(locale, setlocale(LC_TIME, NULL), sizeof(locale));
+#ifdef LC_C_LOCALE
+ r = strptime_l(p, "%a, %d %b %Y %H:%M:%S GMT", &tm, LC_C_LOCALE);
+#else
+ char *locale;
+
+ locale = strdup(setlocale(LC_TIME, NULL));
+ if (locale == NULL)
+ return (-1);
setlocale(LC_TIME, "C");
r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm);
/* XXX should add support for date-2 and date-3 */
setlocale(LC_TIME, locale);
+ free(locale);
+#endif
if (r == NULL)
return (-1);
*mtime = timegm(&tm);
Home |
Main Index |
Thread Index |
Old Index