mirror of git://sourceware.org/git/glibc.git
[BZ #6612]
* time/strftime.c: Pass reference to tzset_called around to handle recursive calls. [BZ #6612] * time/strftime.c (__strftime_internal): Call tzset() only when printing timezone-dependent values. Based on a patch by Petr Baudis <pasky@suse.cz>.
This commit is contained in:
parent
f854efd722
commit
5bcc6c0f96
|
@ -1,5 +1,13 @@
|
||||||
2008-06-12 Ulrich Drepper <drepper@redhat.com>
|
2008-06-12 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* time/strftime.c: Pass reference to tzset_called around to handle
|
||||||
|
recursive calls.
|
||||||
|
|
||||||
|
[BZ #6612]
|
||||||
|
* time/strftime.c (__strftime_internal): Call tzset() only
|
||||||
|
when printing timezone-dependent values.
|
||||||
|
Based on a patch by Petr Baudis <pasky@suse.cz>.
|
||||||
|
|
||||||
* resolv/nss_dns/dns-host.c (gaih_getanswer): Don't
|
* resolv/nss_dns/dns-host.c (gaih_getanswer): Don't
|
||||||
unconditionally use second gaih_getanswer_slice result.
|
unconditionally use second gaih_getanswer_slice result.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2004, 2007, 2008 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -455,7 +455,8 @@ static CHAR_T const month_name[][10] =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
|
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
|
||||||
const struct tm *, bool ut_argument_spec_iso
|
const struct tm *, bool *
|
||||||
|
ut_argument_spec_iso
|
||||||
LOCALE_PARAM_PROTO) __THROW;
|
LOCALE_PARAM_PROTO) __THROW;
|
||||||
|
|
||||||
/* Write information from TP into S according to the format
|
/* Write information from TP into S according to the format
|
||||||
|
@ -481,7 +482,8 @@ my_strftime (s, maxsize, format, tp ut_argument LOCALE_PARAM)
|
||||||
tmcopy = *tp;
|
tmcopy = *tp;
|
||||||
tp = &tmcopy;
|
tp = &tmcopy;
|
||||||
#endif
|
#endif
|
||||||
return __strftime_internal (s, maxsize, format, tp, false
|
bool tzset_called = false;
|
||||||
|
return __strftime_internal (s, maxsize, format, tp, &tzset_called
|
||||||
ut_argument LOCALE_ARG);
|
ut_argument LOCALE_ARG);
|
||||||
}
|
}
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
|
@ -495,7 +497,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
|
||||||
size_t maxsize;
|
size_t maxsize;
|
||||||
const CHAR_T *format;
|
const CHAR_T *format;
|
||||||
const struct tm *tp;
|
const struct tm *tp;
|
||||||
bool tzset_called;
|
bool *tzset_called;
|
||||||
ut_argument_spec
|
ut_argument_spec
|
||||||
LOCALE_PARAM_DECL
|
LOCALE_PARAM_DECL
|
||||||
{
|
{
|
||||||
|
@ -563,16 +565,6 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
|
||||||
if (! (zone && *zone))
|
if (! (zone && *zone))
|
||||||
zone = "GMT";
|
zone = "GMT";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* POSIX.1 requires that local time zone information is used as
|
|
||||||
though strftime called tzset. */
|
|
||||||
# if HAVE_TZSET
|
|
||||||
if (!tzset_called)
|
|
||||||
tzset ();
|
|
||||||
tzset_called = true;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (hour12 > 12)
|
if (hour12 > 12)
|
||||||
|
@ -1325,7 +1317,18 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
|
||||||
#if HAVE_TZNAME
|
#if HAVE_TZNAME
|
||||||
/* The tzset() call might have changed the value. */
|
/* The tzset() call might have changed the value. */
|
||||||
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
||||||
|
{
|
||||||
|
/* POSIX.1 requires that local time zone information is used as
|
||||||
|
though strftime called tzset. */
|
||||||
|
# if HAVE_TZSET
|
||||||
|
if (!*tzset_called)
|
||||||
|
{
|
||||||
|
tzset ();
|
||||||
|
*tzset_called = true;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
zone = tzname[tp->tm_isdst];
|
zone = tzname[tp->tm_isdst];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (! zone)
|
if (! zone)
|
||||||
zone = "";
|
zone = "";
|
||||||
|
@ -1361,6 +1364,16 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
|
||||||
struct tm ltm;
|
struct tm ltm;
|
||||||
time_t lt;
|
time_t lt;
|
||||||
|
|
||||||
|
/* POSIX.1 requires that local time zone information is used as
|
||||||
|
though strftime called tzset. */
|
||||||
|
# if HAVE_TZSET
|
||||||
|
if (!*tzset_called)
|
||||||
|
{
|
||||||
|
tzset ();
|
||||||
|
*tzset_called = true;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
ltm = *tp;
|
ltm = *tp;
|
||||||
lt = mktime (<m);
|
lt = mktime (<m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue