diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2015-03-03 09:08:05 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-04-21 10:18:48 +0200 |
commit | 71f55f38cb3dd804176e7f382f52b75ddcd437de (patch) | |
tree | 59f028f69361edb116ffeb862c6ead5a7cfb7d5d /vtysh/vtysh_main.c | |
parent | fd8f6ebb4c6b9e5364b98d2b5fd345d1dcc08824 (diff) | |
download | quagga-71f55f38cb3dd804176e7f382f52b75ddcd437de.tar.bz2 quagga-71f55f38cb3dd804176e7f382f52b75ddcd437de.tar.xz |
lib, vtysh: reduce unneccessary C extension usage
We're only supporting GCC, Clang and ICC; but there's no reason to use
nonstandard C constructs if they don't actually provide any benefit.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'vtysh/vtysh_main.c')
-rw-r--r-- | vtysh/vtysh_main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 48958f0f..893c1a1c 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -202,9 +202,12 @@ static void log_it(const char *line) { time_t t = time(NULL); struct tm *tmp = localtime(&t); - char *user = getenv("USER") ? : "boot"; + const char *user = getenv("USER"); char tod[64]; + if (!user) + user = "boot"; + strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp); fprintf(logfile, "%s:%s %s\n", tod, user, line); |