mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
4668. [bug] Use localtime_r and gmtime_r for thread safety.
[RT #45664]
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <isc/app.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/parseint.h>
|
||||
#include <isc/platform.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/task.h>
|
||||
@@ -261,7 +262,12 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||
printf(";; Query time: %ld msec\n", (long) diff / 1000);
|
||||
printf(";; SERVER: %s(%s)\n", fromtext, query->servname);
|
||||
time(&tnow);
|
||||
#if defined(ISC_PLATFORM_USETHREADS) && !defined(WIN32)
|
||||
(void)localtime_r(&tnow, &tmnow);
|
||||
#else
|
||||
tmnow = *localtime(&tnow);
|
||||
#endif
|
||||
|
||||
if (strftime(time_str, sizeof(time_str),
|
||||
"%a %b %d %H:%M:%S %Z %Y", &tmnow) > 0U)
|
||||
printf(";; WHEN: %s\n", time_str);
|
||||
|
Reference in New Issue
Block a user