diff options
author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2024-10-15 18:11:03 +0200 |
---|---|---|
committer | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2024-10-15 18:11:03 +0200 |
commit | 38661a6aa50204e7204182bf7eeec45e2a87f14b (patch) | |
tree | 3ec33cfe69cd4d8374216f64f858402ab9a0a041 | |
parent | Merge pull request #17106 from louis-6wind/fix-bmp-converity (diff) | |
download | frr-38661a6aa50204e7204182bf7eeec45e2a87f14b.tar.xz frr-38661a6aa50204e7204182bf7eeec45e2a87f14b.zip |
vtysh: fix SA warning, no need to call getenv() twice
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
-rw-r--r-- | vtysh/vtysh_main.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 64198132c..297d87ec4 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -350,6 +350,7 @@ int main(int argc, char **argv, char **env) char pathspace[MAXPATHLEN] = ""; const char *histfile = NULL; const char *histfile_env = getenv("VTYSH_HISTFILE"); + const char *logpath = getenv("VTYSH_LOG"); /* SUID: drop down to calling user & go back up when needed */ elevuid = geteuid(); @@ -643,9 +644,7 @@ int main(int argc, char **argv, char **env) } } - if (getenv("VTYSH_LOG")) { - const char *logpath = getenv("VTYSH_LOG"); - + if (logpath != NULL) { logfile = fopen(logpath, "a"); if (!logfile) { fprintf(stderr, "Failed to open logfile (%s): %s\n", |