If gmtime_r(3) fails it should return NULL, it currently returns a
pointer to the unitialised tm struct it was given.


-- 
Carlin



Index: lib/libc/time/localtime.c
===================================================================
RCS file: /cvs/src/lib/libc/time/localtime.c,v
retrieving revision 1.58
diff -u -p -u -r1.58 localtime.c
--- lib/libc/time/localtime.c   14 Mar 2016 15:26:52 -0000      1.58
+++ lib/libc/time/localtime.c   10 Sep 2016 06:06:24 -0000
@@ -1350,8 +1350,7 @@ gmtsub(const time_t *timep, long offset,
 struct tm *
 gmtime_r(const time_t *timep, struct tm *p_tm)
 {
-       gmtsub(timep, 0L, p_tm);
-       return p_tm;
+       return gmtsub(timep, 0L, p_tm);
 }
 DEF_WEAK(gmtime_r);
 

Reply via email to