Module Name: othersrc
Committed By: lukem
Date: Sun May 5 11:51:43 UTC 2013
Modified Files:
othersrc/usr.bin/tnftp/src: util.c
Log Message:
Only use setlocale() if it's available.
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 othersrc/usr.bin/tnftp/src/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/usr.bin/tnftp/src/util.c
diff -u othersrc/usr.bin/tnftp/src/util.c:1.22 othersrc/usr.bin/tnftp/src/util.c:1.23
--- othersrc/usr.bin/tnftp/src/util.c:1.22 Sun May 5 11:17:31 2013
+++ othersrc/usr.bin/tnftp/src/util.c Sun May 5 11:51:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.22 2013/05/05 11:17:31 lukem Exp $ */
+/* $NetBSD: util.c,v 1.23 2013/05/05 11:51:43 lukem Exp $ */
/* from NetBSD: util.c,v 1.158 2013/02/19 23:29:15 dsl Exp */
/*-
@@ -803,11 +803,13 @@ const char *
parse_rfc2616time(struct tm *parsed, const char *httpdate)
{
const char *t;
+#if defined(HAVE_SETLOCALE)
const char *curlocale;
/* The representation of %a depends on the current locale. */
curlocale = setlocale(LC_TIME, NULL);
(void)setlocale(LC_TIME, "C");
+#endif
/* RFC 1123 */
if ((t = strptime(httpdate, "%a, %d %b %Y %H:%M:%S GMT", parsed)) ||
/* RFC 850 */
@@ -816,7 +818,9 @@ parse_rfc2616time(struct tm *parsed, con
(t = strptime(httpdate, "%a, %b %d %H:%M:%S %Y", parsed))) {
; /* do nothing */
}
+#if defined(HAVE_SETLOCALE)
(void)setlocale(LC_TIME, curlocale);
+#endif
return t;
}