e6ab6d48dc
point to a tty. Unfortunately the shell assumed that it could do all process group handling ioctls to fd=2, but this is not correct. Jobs that redirected fd=2 would be unable to perform the ioctls and silently fail since the error reporting channel is fd=2... Instead open /dev/tty set it to close on exec, and use that instead (like all other shells do). We don't handle the case where the OS does not provide FD_CLOEXEC or FIOCLEX, because I am lazy. While I am there: - Simplify the code by defining functions for tc{g,s}pgrp when OLD_TTY_DRIVER is defined. - make sure that 'sh &' works by stopping itself. Don't kill the shell's process group, kill the shell itself.