Module Name:    src
Committed By:   ginsbach
Date:           Fri Mar 18 12:41:25 UTC 2016

Modified Files:
        src/lib/libc/time: localtime.c

Log Message:
Use the correct upper bounds for the types array.  The correct upper
bound is typecnt not timecnt.  Now perpetual 'standard' time zones
will work correctly as they have a typecnt of 1 but a timecnt of 0.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/lib/libc/time/localtime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.102 src/lib/libc/time/localtime.c:1.103
--- src/lib/libc/time/localtime.c:1.102	Tue Mar 15 15:16:01 2016
+++ src/lib/libc/time/localtime.c	Fri Mar 18 12:41:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.102 2016/03/15 15:16:01 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.102 2016/03/15 15:16:01 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -282,7 +282,7 @@ const char *
 tzgetname(const timezone_t sp, int isdst)
 {
 	int i;
-	for (i = 0; i < sp->timecnt; ++i) {
+	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
 
 		if (ttisp->tt_isdst == isdst)
@@ -297,7 +297,7 @@ tzgetgmtoff(const timezone_t sp, int isd
 {
 	int i;
 	long l = -1;
-	for (i = 0; i < sp->timecnt; ++i) {
+	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
 
 		if (ttisp->tt_isdst == isdst) {

Reply via email to