diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-10-16 09:50:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-16 09:50:02 +0200 |
commit | 40dce0be6a8f1cad15fce434177b48f9e69b96dd (patch) | |
tree | 4357df40613c26f8239060c323e03c87187ee0c7 | |
parent | Merge pull request #17116 from enkechen-panw/zfix-2 (diff) | |
parent | vtysh: fix SA warning, no need to call getenv() twice (diff) | |
download | frr-40dce0be6a8f1cad15fce434177b48f9e69b96dd.tar.xz frr-40dce0be6a8f1cad15fce434177b48f9e69b96dd.zip |
Merge pull request #17114 from Jafaral/getenv
vtysh: fix SA warning, no need to call getenv() twice
-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", |