Prevent pipes from becoming the controlling tty

This commit is contained in:
Joey Schulze 2007-07-04 19:04:02 +00:00
parent c972380fef
commit 2a2ab0cb77
2 changed files with 7 additions and 2 deletions

View File

@ -39,6 +39,7 @@ Version 1.5
- Complete rewrite of the oops kernel module for Linux 2.6 - Complete rewrite of the oops kernel module for Linux 2.6
- Only read kernel symbols from /proc/kallsyms if no System.map has been read - Only read kernel symbols from /proc/kallsyms if no System.map has been read
- Improved symbol lookup - Improved symbol lookup
- Prevent named pipes from becoming the controlling tty
. Jon Burgess <Jon_Burgess@eur.3com.com> . Jon Burgess <Jon_Burgess@eur.3com.com>
- Moved the installation of the signal handler up a little bit so it - Moved the installation of the signal handler up a little bit so it
guaranteed to be available when the child is forked, hence, fixing a guaranteed to be available when the child is forked, hence, fixing a

View File

@ -490,6 +490,10 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88";
* Mon May 28 19:44:39 CEST 2007: Martin Schulze <joey@infodrom.org> * Mon May 28 19:44:39 CEST 2007: Martin Schulze <joey@infodrom.org>
* Notify the waiting parent process if the client dies to it * Notify the waiting parent process if the client dies to it
* doesn't wait the entire five minutes. * doesn't wait the entire five minutes.
*
* Wed Jul 4 21:02:22 CEST 2007: Martin Schulze <joey@infodrom.org>
* Open a pipe with O_NOCTTY to avoid them becoming the controlling
* tty and normal files with O_NONBLOCK to avoid blocking.
*/ */
@ -2736,10 +2740,10 @@ void cfline(line, f)
if (syncfile) if (syncfile)
f->f_flags |= SYNC_FILE; f->f_flags |= SYNC_FILE;
if ( *p == '|' ) { if ( *p == '|' ) {
f->f_file = open(++p, O_RDWR|O_NONBLOCK); f->f_file = open(++p, O_RDWR|O_NONBLOCK|O_NOCTTY);
f->f_type = F_PIPE; f->f_type = F_PIPE;
} else { } else {
f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NONBLOCK|O_NOCTTY,
0644); 0644);
f->f_type = F_FILE; f->f_type = F_FILE;
} }