Subject: CVS commit: basesrc/bin/sh
To: None <>
From: Christos Zoulas <>
List: source-changes
Date: 04/03/2002 17:30:46
Module Name:	basesrc
Committed By:	christos
Date:		Wed Apr  3 14:30:46 UTC 2002

Modified Files:
	basesrc/bin/sh: jobs.c

Log Message:
PR/16174: Matthias Buelow: Job control fails on jobs that fd == 2 does not
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.

To generate a diff of this commit:
cvs rdiff -r1.43 -r1.44 basesrc/bin/sh/jobs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.