aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-04-04 13:56:16 +0200
committerBrian Behlendorf <[email protected]>2022-04-05 09:45:24 -0700
commit8ab279484f9987d26188782149dbed03c11ed1cd (patch)
tree4e9c8e81cdac871e7787aa463620d803240590c2 /lib
parentd5036491e6d76a957e04e3e74c6fb50352ba94b0 (diff)
libzfs: sendrecv: send_progress_thread: use localtime_r()
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13284
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_sendrecv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index c9d45e22c..9214e7b74 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -910,7 +910,7 @@ send_progress_thread(void *arg)
uint64_t blocks;
char buf[16];
time_t t;
- struct tm *tm;
+ struct tm tm;
int err;
if (!pa->pa_parsable) {
@@ -934,28 +934,28 @@ send_progress_thread(void *arg)
}
(void) time(&t);
- tm = localtime(&t);
+ localtime_r(&t, &tm);
if (pa->pa_verbosity >= 2 && pa->pa_parsable) {
(void) fprintf(stderr,
"%02d:%02d:%02d\t%llu\t%llu\t%s\n",
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
(u_longlong_t)bytes, (u_longlong_t)blocks,
zhp->zfs_name);
} else if (pa->pa_verbosity >= 2) {
zfs_nicenum(bytes, buf, sizeof (buf));
(void) fprintf(stderr,
"%02d:%02d:%02d %5s %8llu %s\n",
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
buf, (u_longlong_t)blocks, zhp->zfs_name);
} else if (pa->pa_parsable) {
(void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n",
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
(u_longlong_t)bytes, zhp->zfs_name);
} else {
zfs_nicebytes(bytes, buf, sizeof (buf));
(void) fprintf(stderr, "%02d:%02d:%02d %5s %s\n",
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
buf, zhp->zfs_name);
}
}