It looks like decided to use TM_ZONE as a wrapper for tm.tm_zone,
until the tm_zone is gone. So, until the later happens (I found
no usage of tm_zone in base, BTW), we should at least use TM_ZONE
consistently. Okay for the patch? Or should I proceed to the TM_ZONE
removal together with next libc major bump?

Please note that some software doesn't zero out struct tm before
use, resulting in garbage being written to this field. If you'd
call the strftime() or wcsftime() on such struct, you'll get core
dumped (in the best case). I'm looking at you, Qt!

--
WBR,
  Vadim Zhukov


Index: wcsftime.c
===================================================================
RCS file: /cvs/src/lib/libc/time/wcsftime.c,v
retrieving revision 1.6
diff -u -p -r1.6 wcsftime.c
--- wcsftime.c  9 Feb 2015 14:52:28 -0000       1.6
+++ wcsftime.c  28 Feb 2016 11:01:48 -0000
@@ -438,9 +438,11 @@ label:
                        pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1, pt, ptlim);
                        continue;
                case 'Z':
-                       if (t->tm_zone != NULL)
+#ifdef TM_ZONE
+                       if (t->TM_ZONE != NULL)
                                pt = _sadd(t->TM_ZONE, pt, ptlim);
                        else
+#endif
                                if (t->tm_isdst >= 0)
                                        pt = _sadd(tzname[t->tm_isdst != 0], 
                                            pt, ptlim);

Reply via email to