Don't forget to FIOCLEX the internal copies of stdout,stderr,stddiag when

we invoke a subshell. Otherwise the executed command gets invoked with
17,18,19 open.
This commit is contained in:
christos 2004-09-28 16:07:01 +00:00
parent dd9f33983a
commit d12e6436f9
1 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sem.c,v 1.23 2003/08/07 09:05:07 agc Exp $ */
/* $NetBSD: sem.c,v 1.24 2004/09/28 16:07:01 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: sem.c,v 1.23 2003/08/07 09:05:07 agc Exp $");
__RCSID("$NetBSD: sem.c,v 1.24 2004/09/28 16:07:01 christos Exp $");
#endif
#endif /* not lint */
@ -379,10 +379,11 @@ execute(struct command *t, int wanttty, int *pipein, int *pipeout)
/*
* For () commands must put new 0,1,2 in FSH* and recurse
*/
OLDSTD = dcopy(0, FOLDSTD);
SHOUT = dcopy(1, FSHOUT);
SHERR = dcopy(2, FSHERR);
(void) ioctl(OLDSTD = dcopy(0, FOLDSTD), FIOCLEX, NULL);
(void) ioctl(SHOUT = dcopy(1, FSHOUT), FIOCLEX, NULL);
(void) ioctl(SHERR = dcopy(2, FSHERR), FIOCLEX, NULL);
(void) close(SHIN);
SHIN = -1;
didfds = 0;
wanttty = -1;