diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-11-04 14:51:34 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-11-04 14:51:34 +0000 |
commit | b5882bdf826f86fe99c8ba32265622dcc6139367 (patch) | |
tree | 5b7c99ba20aa6b3430bff69bcaa9ce17241827a6 /usr.bin/su/su.c | |
parent | 9295c1ca712c220aa8e5ae69ed3d287eeb4ea9df (diff) | |
download | FreeBSD-src-b5882bdf826f86fe99c8ba32265622dcc6139367.zip FreeBSD-src-b5882bdf826f86fe99c8ba32265622dcc6139367.tar.gz |
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.
Diffstat (limited to 'usr.bin/su/su.c')
-rw-r--r-- | usr.bin/su/su.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index 8eac299..b70e994 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -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(); |