bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] mktime: fix timegm bug that set tmp->tm_isdst


From: Paul Eggert
Subject: [PATCH 2/3] mktime: fix timegm bug that set tmp->tm_isdst
Date: Fri, 4 Oct 2024 21:15:17 -0700

* lib/timegm.c (__timegm64): Omit now-unnecessary initialization
of tm_isdst.  Anyway, the initialization was always wrong, since
timegm should not modify *TMP when it fails.
---
 ChangeLog    | 5 +++++
 lib/timegm.c | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6d8a1a52b3..cea31f84e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2024-10-04  Paul Eggert  <eggert@cs.ucla.edu>
 
+       mktime: fix timegm bug that set tmp->tm_isdst
+       * lib/timegm.c (__timegm64): Omit now-unnecessary initialization
+       of tm_isdst.  Anyway, the initialization was always wrong, since
+       timegm should not modify *TMP when it fails.
+
        mktime: refactor to get closer to glibc
        * lib/mktime.c (convert_time): Reorder args.
        (__tz_convert): New macro.  All convert_time callers changed to use it.
diff --git a/lib/timegm.c b/lib/timegm.c
index 1f1f66c61b..ba28b3ecd9 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -30,7 +30,6 @@ __time64_t
 __timegm64 (struct tm *tmp)
 {
   static mktime_offset_t gmtime_offset;
-  tmp->tm_isdst = 0;
   return __mktime_internal (tmp, false, &gmtime_offset);
 }
 
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]