commit: 95b80fffe91cf37a48ec064efad5910e41d0d30e
parent 371f5a899203fa1af6a11a45e794da7ea7ee2b01
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 9 Oct 2022 03:49:50 +0200
su: Fix initial environment (HOME and IFS)
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/su.c b/su.c
@@ -175,11 +175,11 @@ main(int argc, char *argv[])
shell = pwent->pw_shell;
}
- if((!opt_l) && (pwent->pw_dir != NULL))
+ if(pwent->pw_dir != NULL)
{
setenv("HOME", pwent->pw_dir, 1);
- if(chdir(pwent->pw_dir) != 0)
+ if(!opt_l && (chdir(pwent->pw_dir) != 0))
{
perror("chdir");
}
@@ -201,6 +201,7 @@ main(int argc, char *argv[])
}
setenv("SHELL", shell, 1);
+ setenv("IFS", " \t\n", 1);
errno = 0;
int ret = 0;