Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Do not force errno to EOVERFLOW when returning...



details:   https://anonhg.NetBSD.org/src/rev/53cd6a2ff441
branches:  trunk
changeset: 772528:53cd6a2ff441
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jan 07 15:19:35 2012 +0000

description:
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.

diffstat:

 lib/libc/time/localtime.c |  8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r a47b1ed2be67 -r 53cd6a2ff441 lib/libc/time/localtime.c
--- a/lib/libc/time/localtime.c Sat Jan 07 15:05:22 2012 +0000
+++ b/lib/libc/time/localtime.c Sat Jan 07 15:19:35 2012 +0000
@@ -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 @@
        if (tmp != NULL)
                tmp->tm_isdst = 0;
        t = time1(gmtptr, tmp, gmtsub, 0L);
-       if (t == WRONG)
-               errno = EOVERFLOW;
        return t;
 }
 
@@ -2147,8 +2145,6 @@
        if (tmp != NULL)
                tmp->tm_isdst = 0;
        t = time1(gmtptr, tmp, gmtsub, offset);
-       if (t == WRONG)
-               errno = EOVERFLOW;
        return t;
 }
 



Home | Main Index | Thread Index | Old Index