summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vtysh/vtysh_main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 64198132cc..297d87ec41 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",