From b4354cf42008f12cac246759b64db0439a82ce67 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 10 Dec 2007 01:43:40 +0000 Subject: [BZ #5424, BZ #5428, BZ #5451] 2007-12-08 Ulrich Drepper [BZ #5424] * stdio-common/vfprintf.c: Do not overflow when adding to done. * stdio-common/Makefile (tests): Add bug22. * stdio-common/bug22.c: New file. [BZ #5451] * time/getdate.c: Fix filling in default values. * time/bug-getdate1.c: New file. * time/Makefile: Add rules to build and run bug-getdate1. * iconvdata/ebcdic-is-friss.c: Use 8bit-gap instead of 8bit-generic. * iconvdata/ebcdic-es.c: Likewise. * iconvdata/ebcdic-es-a.c: Likewise. * iconvdata/ebcdic-uk.c: Likewise. * iconvdata/iso8859-16.c: Likewise. * iconvdata/viscii.c: Likewise. * iconvdata/iso8859-9e.c: Likewise. * iconvdata/Makefile: Adjust appropriately. [BZ #5428] * wcsmbs/wchar.h: Unconditionally undefine __need_mbstate and __need_wint_t. * iconvdata/gconv-modules: Likewise. --- time/getdate.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'time/getdate.c') diff --git a/time/getdate.c b/time/getdate.c index 851efacfd2..cbaa41dfd2 100644 --- a/time/getdate.c +++ b/time/getdate.c @@ -212,28 +212,31 @@ __getdate_r (const char *string, struct tm *tp) tp->tm_sec = tm.tm_sec; } + /* Fill in the gaps. */ + if (tp->tm_hour == INT_MIN) + tp->tm_hour = 0; + if (tp->tm_min == INT_MIN) + tp->tm_min = 0; + if (tp->tm_sec == INT_MIN) + tp->tm_sec = 0; + /* If no date is given, today is assumed if the given hour is greater than the current hour and tomorrow is assumed if it is less. */ if (tp->tm_hour >= 0 && tp->tm_hour <= 23 - && tp->tm_year == INT_MIN && tp->tm_mon == INT_MIN + && tp->tm_mon == INT_MIN && tp->tm_mday == INT_MIN && tp->tm_wday == INT_MIN) { - tp->tm_year = tm.tm_year; tp->tm_mon = tm.tm_mon; tp->tm_mday = tm.tm_mday + ((tp->tm_hour - tm.tm_hour) < 0 ? 1 : 0); mday_ok = 1; } - /* Fill in the gaps. */ + /* More fillers. */ if (tp->tm_year == INT_MIN) tp->tm_year = tm.tm_year; - if (tp->tm_hour == INT_MIN) - tp->tm_hour = 0; - if (tp->tm_min == INT_MIN) - tp->tm_min = 0; - if (tp->tm_sec == INT_MIN) - tp->tm_sec = 0; + if (tp->tm_mon == INT_MIN) + tp->tm_mon = tm.tm_mon; /* Check if the day of month is within range, and if the time can be represented in a time_t. We make use of the fact that the mktime -- cgit 1.4.1