[PATCH] strftime: use tzname if TM_ZONE is NULL

Yaakov Selkowitz yselkowi@redhat.com
Mon Mar 30 19:31:00 GMT 2015

On Wed, 2015-03-25 at 16:46 -0500, Yaakov Selkowitz wrote:
> * libc/time/strftime.c (strftime) <%Z>: Initialize tznam to NULL.
> Use _tzname as fallback if TM_ZONE is NULL.
> ---
> The crash was due to a strlen(NULL) a few lines later, which should NOT
> happen.  glibc takes this a step further and calls tzset() if not yet
> called so that the returned string matches the local timezone (instead
> of "GMT", or on Cygwin, "   ").  The question is how to (portably)
> determine if tzset() has been called already or not (e.g. a global
> variable?).

Craig's patch would take care of this, so I'd like to repropose this
patch as is.

Yaakov Selkowitz
Associate Software Engineer, ARM
Red Hat, Inc.

More information about the Newlib mailing list