From f6b24257f53becdbc5d162f4afedac8cbed191d5 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Mon, 28 May 2007 17:02:06 +0000 Subject: [PATCH] Patch by Andreas Barth: Prevent pipes from becoming the controlling tty --- syslogd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/syslogd.c b/syslogd.c index e74b659..69ef7c1 100644 --- a/syslogd.c +++ b/syslogd.c @@ -486,6 +486,9 @@ static char sccsid[] = "@(#)syslogd.c 5.27 (Berkeley) 10/10/88"; * * Sat May 26 12:22:44 CEST 2007: Martin Schulze * Properly accompany the MARK message with the facility. + * + * Mon May 28 19:00:37 CEST 2007: Andreas Barth + * Prevent pipes from becoming the controlling tty. */ @@ -2722,13 +2725,12 @@ void cfline(line, f) if (syncfile) f->f_flags |= SYNC_FILE; if ( *p == '|' ) { - f->f_file = open(++p, O_RDWR|O_NONBLOCK); f->f_type = F_PIPE; - } else { - f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, - 0644); + p++; + } else f->f_type = F_FILE; - } + f->f_file = open(p, O_WRONLY|O_APPEND|O_CREAT|O_NOBLOCK|O_NOCTTY, + 0644); if ( f->f_file < 0 ){ f->f_file = -1;