systime-fix: Replace asctime() with thread-safe asctime_r()

According to the man page, the buffer should have room for at least
26 characters.
This commit is contained in:
Tobias Brunner 2020-01-28 14:55:25 +01:00
parent 584e8197fe
commit 18a3e6d80f
1 changed files with 3 additions and 2 deletions

View File

@ -205,7 +205,7 @@ static bool load_validator(private_systime_fix_plugin_t *this)
struct tm tm = {
.tm_mday = 1,
};
char *str, *fmt;
char *str, *fmt, buf[32];
fmt = lib->settings->get_str(lib->settings,
"%s.plugins.%s.threshold_format", "%Y", lib->ns, get_name(this));
@ -235,7 +235,8 @@ static bool load_validator(private_systime_fix_plugin_t *this)
return FALSE;
}
DBG1(DBG_CFG, "enabling %s, threshold: %s", get_name(this), asctime(&tm));
DBG1(DBG_CFG, "enabling %s, threshold: %s", get_name(this),
asctime_r(&tm, buf));
this->validator = systime_fix_validator_create(this->threshold);
return TRUE;
}