forked from Bananymous/banan-os
init: Don't leak pwent fd to child processes
This commit is contained in:
@@ -114,7 +114,12 @@ int main()
|
||||
setenv("HOME", pwd->pw_dir, 1);
|
||||
chdir(pwd->pw_dir);
|
||||
|
||||
execl(pwd->pw_shell, pwd->pw_shell, nullptr);
|
||||
char shell_path[PATH_MAX];
|
||||
strcpy(shell_path, pwd->pw_shell);
|
||||
|
||||
endpwent();
|
||||
|
||||
execl(shell_path, shell_path, nullptr);
|
||||
perror("execl");
|
||||
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user