aboutsummaryrefslogtreecommitdiff
path: root/time/offtime.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-05-16 06:14:36 +0000
committerUlrich Drepper <drepper@redhat.com>2002-05-16 06:14:36 +0000
commitf7501ae6f14a1b27a4f98bdaf4f2aad929cf68b7 (patch)
tree7795c494c2ccc1028fe51d074b33dd2afab0efd4 /time/offtime.c
parent4e960bbf4ef07f7ef2d9888ddd7419dc4c8cfbf9 (diff)
downloadglibc-f7501ae6f14a1b27a4f98bdaf4f2aad929cf68b7.zip
glibc-f7501ae6f14a1b27a4f98bdaf4f2aad929cf68b7.tar.gz
glibc-f7501ae6f14a1b27a4f98bdaf4f2aad929cf68b7.tar.bz2
Update.
* stdlib/canonicalize.c (canonicalize): Rename to __realpath and don't define static. Remove old __realpath function. TC1 of POSIX 2001 will allow the second parameter to be NULL. * stdlib/test-canon.c: Comment out test for NULL as second parameter of realpath. * time/offtime.c (__offtime): Set errno if overflow is detected.
Diffstat (limited to 'time/offtime.c')
-rw-r--r--time/offtime.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/time/offtime.c b/time/offtime.c
index 59f1b2c..c0b1db5 100644
--- a/time/offtime.c
+++ b/time/offtime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1997, 1998, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <time.h>
#define SECS_PER_HOUR (60 * 60)
@@ -73,7 +74,11 @@ __offtime (t, offset, tp)
}
tp->tm_year = y - 1900;
if (tp->tm_year != y - 1900)
- return 0;
+ {
+ /* The year cannot be represented due to overflow. */
+ __set_errno (EOVERFLOW);
+ return 0;
+ }
tp->tm_yday = days;
ip = __mon_yday[__isleap(y)];
for (y = 11; days < (long int) ip[y]; --y)