mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 03:28:31 +00:00
Merge pull request #12557 from donaldsharp/getenv_two_times
vtysh: Remove double retrieve of env VTYSH_HISTFILE
This commit is contained in:
commit
cb8d1c5598
@ -354,6 +354,7 @@ int main(int argc, char **argv, char **env)
|
|||||||
const char *pathspace_arg = NULL;
|
const char *pathspace_arg = NULL;
|
||||||
char pathspace[MAXPATHLEN] = "";
|
char pathspace[MAXPATHLEN] = "";
|
||||||
const char *histfile = NULL;
|
const char *histfile = NULL;
|
||||||
|
const char *histfile_env = getenv("VTYSH_HISTFILE");
|
||||||
|
|
||||||
/* SUID: drop down to calling user & go back up when needed */
|
/* SUID: drop down to calling user & go back up when needed */
|
||||||
elevuid = geteuid();
|
elevuid = geteuid();
|
||||||
@ -611,10 +612,8 @@ int main(int argc, char **argv, char **env)
|
|||||||
* VTYSH_HISTFILE is preferred over command line
|
* VTYSH_HISTFILE is preferred over command line
|
||||||
* argument (-H/--histfile).
|
* argument (-H/--histfile).
|
||||||
*/
|
*/
|
||||||
if (getenv("VTYSH_HISTFILE")) {
|
if (histfile_env) {
|
||||||
const char *file = getenv("VTYSH_HISTFILE");
|
strlcpy(history_file, histfile_env, sizeof(history_file));
|
||||||
|
|
||||||
strlcpy(history_file, file, sizeof(history_file));
|
|
||||||
} else if (histfile) {
|
} else if (histfile) {
|
||||||
strlcpy(history_file, histfile, sizeof(history_file));
|
strlcpy(history_file, histfile, sizeof(history_file));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user