[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] mktime.c: normalize tp->tm_isdst value to -1/0/1.
From: |
Jim Meyering |
Subject: |
[PATCH] mktime.c: normalize tp->tm_isdst value to -1/0/1. |
Date: |
Wed, 23 Jul 2008 16:31:59 +0200 |
Here's another from glibc:
>From 5490f5a9848076555e5cdac9b6613b9d107a6ac2 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <address@hidden>
Date: Wed, 23 Jul 2008 16:19:15 +0200
Subject: [PATCH] mktime.c: normalize tp->tm_isdst value to -1/0/1.
* lib/mktime.c (__mktime_internal): Normalize tp->tm_isdst value.
Reported by Michael Ringe <address@hidden> in
<http://sourceware.org/bugzilla/show_bug.cgi?id=6723>.
---
ChangeLog | 5 +++++
lib/mktime.c | 4 +++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 97f6c76..6c48308 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-07-23 Ulrich Drepper <address@hidden>
+ mktime.c: normalize tp->tm_isdst value to -1/0/1.
+ * lib/mktime.c (__mktime_internal): Normalize tp->tm_isdst value.
+ Reported by Michael Ringe <address@hidden> in
+ <http://sourceware.org/bugzilla/show_bug.cgi?id=6723>.
+
* lib/canonicalize-lgpl.c (__realpath): Avoid buffer overflow after
readlink on platforms without PATH_MAX.
diff --git a/lib/mktime.c b/lib/mktime.c
index a91fb20..f9e7b60 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -290,7 +290,9 @@ __mktime_internal (struct tm *tp,
int mday = tp->tm_mday;
int mon = tp->tm_mon;
int year_requested = tp->tm_year;
- int isdst = tp->tm_isdst;
+ /* Normalize the value. */
+ int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1))
+ | (tp->tm_isdst != 0));
/* 1 if the previous probe was DST. */
int dst2;
--
1.6.0.rc0.16.g6458d
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] mktime.c: normalize tp->tm_isdst value to -1/0/1.,
Jim Meyering <=