1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Be sure to restore foreground group to parent su before parent su

exits, otherwise shell will be confused and does not set foreground
group correctly for next su command. This sounds like a bug in sh.
This commit is contained in:
David Xu 2003-11-04 14:51:34 +00:00
parent 155ea0634c
commit 7430623f55
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122061

View File

@ -363,7 +363,7 @@ main(int argc, char *argv[])
sigaction(SIGTTOU, &sa, NULL);
close(fds[0]);
setpgid(child_pid, child_pid);
tcsetpgrp(1, child_pid);
tcsetpgrp(STDERR_FILENO, child_pid);
close(fds[1]);
sigaction(SIGPIPE, &sa_pipe, NULL);
while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) {
@ -377,6 +377,7 @@ main(int argc, char *argv[])
}
break;
}
tcsetpgrp(STDERR_FILENO, getpgrp());
if (pid == -1)
err(1, "waitpid");
PAM_END();