strftime: use tzname if TM_ZONE is NULL
This avoids a strlen(NULL) crash a few lines later. * libc/time/strftime.c (strftime) <%Z>: Initialize tznam to NULL. Use _tzname as fallback if TM_ZONE is NULL.
This commit is contained in:
parent
1f9716e160
commit
84304a44b1
|
@ -1,3 +1,8 @@
|
|||
2015-03-30 Yaakov Selkowitz <yselkowi@redhat.com>
|
||||
|
||||
* libc/time/strftime.c (strftime) <%Z>: Initialize tznam to NULL.
|
||||
Use _tzname as fallback if TM_ZONE is NULL.
|
||||
|
||||
2015-03-30 Yaakov Selkowitz <yselkowi@redhat.com>
|
||||
|
||||
* libc/include/libgen.h (_BASENAME_DEFINED): Define.
|
||||
|
|
|
@ -1311,7 +1311,7 @@ recurse:
|
|||
if (tim_p->tm_isdst >= 0)
|
||||
{
|
||||
size_t size;
|
||||
const char *tznam;
|
||||
const char *tznam = NULL;
|
||||
|
||||
TZ_LOCK;
|
||||
#if defined (__CYGWIN__)
|
||||
|
@ -1320,9 +1320,9 @@ recurse:
|
|||
tznam = __cygwin_gettzname (tim_p);
|
||||
#elif defined (__TM_ZONE)
|
||||
tznam = tim_p->__TM_ZONE;
|
||||
#else
|
||||
tznam = _tzname[tim_p->tm_isdst > 0];
|
||||
#endif
|
||||
if (!tznam)
|
||||
tznam = _tzname[tim_p->tm_isdst > 0];
|
||||
/* Note that in case of wcsftime this loop only works for
|
||||
timezone abbreviations using the portable codeset (aka ASCII).
|
||||
This seems to be the case, but if that ever changes, this
|
||||
|
|
Loading…
Reference in New Issue