Commit 744061a0 authored by Mark Andrews's avatar Mark Andrews
Browse files

4738. [port] win32: strftime mishandles %Z. [RT #46039]

parent 08151d7f
4738. [port] win32: strftime mishandles %Z. [RT #46039]
4737. [cleanup] Address Coverity warnings. [RT #46012]
 
4736. [cleanup] (a) Added comments to NSEC3-related functions in
......
......@@ -231,7 +231,11 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
isc_uint64_t diff;
time_t tnow;
struct tm tmnow;
#ifdef WIN32
wchar_t time_str[100];
#else
char time_str[100];
#endif
char fromtext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_format(from, fromtext, sizeof(fromtext));
......@@ -250,9 +254,19 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
tmnow = *localtime(&tnow);
#endif
#ifdef WIN32
/*
* On Windows, time zone name ("%Z") may be a localized
* wide-character string, which strftime() handles incorrectly.
*/
if (wcsftime(time_str, sizeof(time_str)/sizeof(time_str[0]),
"%a %b %d %H:%M:%S %Z %Y", &tmnow) > 0U)
printf(";; WHEN: %ls\n", time_str);
#else
if (strftime(time_str, sizeof(time_str),
"%a %b %d %H:%M:%S %Z %Y", &tmnow) > 0U)
printf(";; WHEN: %s\n", time_str);
#endif
if (query->lookup->doing_xfr) {
printf(";; XFR size: %u records (messages %u, "
"bytes %" ISC_PRINT_QUADFORMAT "u)\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment