From f989e55d572c803d8ae942523729ecf63841ba01 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 7 Jan 2012 15:19:35 +0000 Subject: [PATCH] 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. --- lib/libc/time/localtime.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c index 5ffa068ae7ff..59d08081d459 100644 --- a/lib/libc/time/localtime.c +++ b/lib/libc/time/localtime.c @@ -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 offset) if (tmp != NULL) tmp->tm_isdst = 0; t = time1(gmtptr, tmp, gmtsub, offset); - if (t == WRONG) - errno = EOVERFLOW; return t; }