aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-04-04 14:07:26 +0200
committerBrian Behlendorf <[email protected]>2022-04-05 09:45:39 -0700
commit9185303b32b370762f12d405b6752166bb5ced47 (patch)
tree9394f111121066e79ce105d8c606a8c34ed11b54
parentae3683ce11153126ae0d03e89dccef96e21ccdf4 (diff)
libspl: zed: event: use localtime_r()
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13284
-rw-r--r--cmd/zed/zed_event.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/zed/zed_event.c b/cmd/zed/zed_event.c
index 9eaad0e92..d5cafdaff 100644
--- a/cmd/zed/zed_event.c
+++ b/cmd/zed/zed_event.c
@@ -884,21 +884,21 @@ _zed_event_get_subclass(const char *class)
static void
_zed_event_add_time_strings(uint64_t eid, zed_strings_t *zsp, int64_t etime[])
{
- struct tm *stp;
+ struct tm stp;
char buf[32];
assert(zsp != NULL);
assert(etime != NULL);
_zed_event_add_var(eid, zsp, ZEVENT_VAR_PREFIX, "TIME_SECS",
- "%lld", (long long int) etime[0]);
+ "%" PRId64, etime[0]);
_zed_event_add_var(eid, zsp, ZEVENT_VAR_PREFIX, "TIME_NSECS",
- "%lld", (long long int) etime[1]);
+ "%" PRId64, etime[1]);
- if (!(stp = localtime((const time_t *) &etime[0]))) {
+ if (!localtime_r((const time_t *) &etime[0], &stp)) {
zed_log_msg(LOG_WARNING, "Failed to add %s%s for eid=%llu: %s",
ZEVENT_VAR_PREFIX, "TIME_STRING", eid, "localtime error");
- } else if (!strftime(buf, sizeof (buf), "%Y-%m-%d %H:%M:%S%z", stp)) {
+ } else if (!strftime(buf, sizeof (buf), "%Y-%m-%d %H:%M:%S%z", &stp)) {
zed_log_msg(LOG_WARNING, "Failed to add %s%s for eid=%llu: %s",
ZEVENT_VAR_PREFIX, "TIME_STRING", eid, "strftime error");
} else {