Skip to content

Commit

Permalink
Merge pull request FRRouting#17114 from Jafaral/getenv
Browse files Browse the repository at this point in the history
vtysh: fix SA warning, no need to call getenv() twice
  • Loading branch information
ton31337 authored Oct 16, 2024
2 parents c32bdc2 + 38661a6 commit 40dce0b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vtysh/vtysh_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 40dce0b

Please sign in to comment.