diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-12-10 01:43:40 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-12-10 01:43:40 +0000 |
commit | b4354cf42008f12cac246759b64db0439a82ce67 (patch) | |
tree | c5f15a5aae3d23cbc4a603bf07532aa85959c404 /time/getdate.c | |
parent | 87520cccf6207f0a3525b5a5d5dc2ffd80b3d416 (diff) | |
download | glibc-b4354cf42008f12cac246759b64db0439a82ce67.tar.gz glibc-b4354cf42008f12cac246759b64db0439a82ce67.tar.xz glibc-b4354cf42008f12cac246759b64db0439a82ce67.zip |
[BZ #5424, BZ #5428, BZ #5451]
2007-12-08 Ulrich Drepper <drepper@redhat.com> [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.
Diffstat (limited to 'time/getdate.c')
-rw-r--r-- | time/getdate.c | 21 |
1 files changed, 12 insertions, 9 deletions
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 |