From 9866b0b749093ed5076ca82f4a501174ba8c73d3 Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 2 Jan 2006 08:51:21 +0000 Subject: Remove broken code that mucks about with tcsetpgrp() -- even if su isn't the foreground process. Hopefully this won't break PAM, but I couldn't find any useful information about ache's theory that it will. Specifically, this change fixes the following: # sh # echo $$ # su - root -c id & # echo $$ The PID output changes as su seems to be kill -STOP'ing itself and catching the parent shell in the process. This is especially bad if you add a ``su - user -c command &'' to an rc script! Sponsored by: Sophos/Activestate Not objected to by: des --- usr.bin/su/su.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'usr.bin/su') diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index f6e0c86..621c351 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -392,22 +392,15 @@ main(int argc, char *argv[]) sa.sa_handler = SIG_IGN; sigaction(SIGTTOU, &sa, NULL); close(fds[0]); - setpgid(child_pid, child_pid); - tcsetpgrp(STDERR_FILENO, child_pid); close(fds[1]); sigaction(SIGPIPE, &sa_pipe, NULL); while ((pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) { if (WIFSTOPPED(statusp)) { - kill(getpid(), SIGSTOP); - child_pgrp = getpgid(child_pid); - tcsetpgrp(1, child_pgrp); - kill(child_pid, SIGCONT); statusp = 1; continue; } break; } - tcsetpgrp(STDERR_FILENO, getpgrp()); if (pid == -1) err(1, "waitpid"); PAM_END(); -- cgit v1.1