]> Savannah Git Hosting - gnulib.git/commitdiff
time_rz: return NULL if localtime_r fails
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Oct 2015 17:24:37 +0000 (10:24 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 Oct 2015 17:25:16 +0000 (10:25 -0700)
* lib/time_rz.c (localtime_rz): Return NULL if localtime_r fails,
while still attempting to pacify bleeding-edge GCC.

ChangeLog
lib/time_rz.c

index 01a05363a3fea387107732acbe29a34aca40077e..3a9768e84356481dd19868850bc72c7ef4210216 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-10-18  Paul Eggert  <eggert@cs.ucla.edu>
 
+       time_rz: return NULL if localtime_r fails
+       * lib/time_rz.c (localtime_rz): Return NULL if localtime_r fails,
+       while still attempting to pacify bleeding-edge GCC.
+
        fts: port to C11 alignof
        * doc/posix-headers/stdalign.texi (stdalign.h):
        Document the C11 restriction.
index 396cdd20206322b370f6c0e7fdde07705782087a..8a0cbb207dbe859909e19659013e9a6a6ebf87cd 100644 (file)
@@ -288,9 +288,8 @@ localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
       timezone_t old_tz = set_tz (tz);
       if (old_tz)
         {
-          if (localtime_r (t, tm) && !save_abbr (tz, tm))
-            tm = NULL;
-          if (revert_tz (old_tz))
+          bool abbr_saved = localtime_r (t, tm) && save_abbr (tz, tm);
+          if (revert_tz (old_tz) && abbr_saved)
             return tm;
         }
       return NULL;