Module Name: src
Committed By: martin
Date: Sat Jan 7 15:19:35 UTC 2012
Modified Files:
src/lib/libc/time: localtime.c
Log Message:
Do not force errno to EOVERFLOW when returning -1 from mktime or friends.
First, there are legitimate cases where we want to return -1 and errno == 0,
second, all paths go through time1() and/or time2sub() which explicitly
take care to set errno in cases of real overflows.
Should fix atf test failure on various ports in
lib/libc/time/t_mktime:timegm_epoch.
To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/lib/libc/time/localtime.c:1.65
--- src/lib/libc/time/localtime.c:1.64 Tue Nov 8 18:37:31 2011
+++ src/lib/libc/time/localtime.c Sat Jan 7 15:19:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: localtime.c,v 1.64 2011/11/08 18:37:31 christos Exp $ */
+/* $NetBSD: localtime.c,v 1.65 2012/01/07 15:19:35 martin 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.64 2011/11/08 18:37:31 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.65 2012/01/07 15:19:35 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -2134,8 +2134,6 @@ timegm(struct tm *const tmp)
if (tmp != NULL)
tmp->tm_isdst = 0;
t = time1(gmtptr, tmp, gmtsub, 0L);
- if (t == WRONG)
- errno = EOVERFLOW;
return t;
}
@@ -2147,8 +2145,6 @@ timeoff(struct tm *const tmp, const long
if (tmp != NULL)
tmp->tm_isdst = 0;
t = time1(gmtptr, tmp, gmtsub, offset);
- if (t == WRONG)
- errno = EOVERFLOW;
return t;
}