mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
output: prefer thread safe function localtime_r()
While the dhcpd-pools might not be threading there is no reason why software should use worse function when always correct alternative is equally easy to use. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
e401c2c7e6
commit
190df198a4
1 changed files with 3 additions and 3 deletions
|
|
@ -458,16 +458,16 @@ int output_json(void)
|
|||
static void html_header(FILE *restrict f)
|
||||
{
|
||||
char outstr[200];
|
||||
struct tm *tmp;
|
||||
struct tm *tmp, result;
|
||||
|
||||
struct stat statbuf;
|
||||
stat(config.dhcpdlease_file, &statbuf);
|
||||
|
||||
tmp = localtime(&statbuf.st_mtime);
|
||||
tmp = localtime_r(&statbuf.st_mtime, &result);
|
||||
if (tmp == NULL) {
|
||||
err(EXIT_FAILURE, "html_header: localtime");
|
||||
}
|
||||
if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), tmp) == 0) {
|
||||
if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), &result) == 0) {
|
||||
errx(EXIT_FAILURE, "html_header: strftime returned 0");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue