diff options
| author | Mark Stapp <mjs@voltanet.io> | 2020-03-05 11:42:12 -0500 |
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2020-03-05 13:26:16 -0500 |
| commit | a2700b5071e53a78be2f8098765dcca58c2b6ee5 (patch) | |
| tree | e32654991ac297bd3917401ae429ee54da385e5e /vtysh/vtysh_main.c | |
| parent | 1e273766cb352792d53fb712487726517ae850b7 (diff) | |
*: use gmtime_r, localtime_r exclusively
Stop using gmtime() or localtime() everywhere.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'vtysh/vtysh_main.c')
| -rw-r--r-- | vtysh/vtysh_main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 5951274257..cc8c536c74 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -229,14 +229,15 @@ static char *vtysh_rl_gets(void) static void log_it(const char *line) { time_t t = time(NULL); - struct tm *tmp = localtime(&t); + struct tm tmp; const char *user = getenv("USER"); char tod[64]; + localtime_r(&t, &tmp); if (!user) user = "boot"; - strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp); + strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", &tmp); fprintf(logfile, "%s:%s %s\n", tod, user, line); } |
