diff options
author | David Sterba <dsterba@suse.com> | 2016-11-07 12:00:28 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-12-14 15:06:34 +0100 |
commit | 590d8b2ee538aee8abd590619461a4bb794b5697 (patch) | |
tree | 4c30c9616b33577fec32abb94f34180d09b116f4 /send-dump.c | |
parent | 798cec84dd1783fcbdfb9c077d8682d8ed8b7b21 (diff) |
btrfs-progs: send dump: use reentrant variant of localtime
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'send-dump.c')
-rw-r--r-- | send-dump.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/send-dump.c b/send-dump.c index 064c914e..4c44246f 100644 --- a/send-dump.c +++ b/send-dump.c @@ -271,16 +271,15 @@ static int print_chown(const char *path, u64 uid, u64 gid, void *user) static int sprintf_timespec(struct timespec *ts, char *dest, int max_size) { - struct tm *tm; + struct tm tm; int ret; - tm = localtime(&ts->tv_sec); - if (!tm) { + if (!localtime_r(&ts->tv_sec, &tm)) { error("failed to convert time %lld.%.9ld to local time", (long long)ts->tv_sec, ts->tv_nsec); return -EINVAL; } - ret = strftime(dest, max_size, "%FT%T%z", tm); + ret = strftime(dest, max_size, "%FT%T%z", &tm); if (ret == 0) { error( "time %lld.%ld is too long to convert into readable string", |