mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 15:18:06 +00:00
vtysh: Use HOME environment variable to get homedir and only fallback to passed entry if no HOME is defined
Snap packages have a local HOME defined inside the SNAP container, but don't get access to passwd entry. Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
parent
87d79a9f79
commit
f38e9e49f5
@ -218,7 +218,12 @@ char *
|
||||
vtysh_get_home (void)
|
||||
{
|
||||
struct passwd *passwd;
|
||||
char * homedir;
|
||||
|
||||
if ((homedir = getenv("HOME")) != 0)
|
||||
return homedir;
|
||||
|
||||
/* Fallback if HOME is undefined */
|
||||
passwd = getpwuid (getuid ());
|
||||
|
||||
return passwd ? passwd->pw_dir : NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user