bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incorrect process substitution setup if stdin closed


From: Andreas Schwab
Subject: Incorrect process substitution setup if stdin closed
Date: Sat, 5 May 2001 20:07:32 +0200

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-2.05
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux' -DCONF_MACHTYPE='i386-suse-linux' -DCONF_VENDOR='suse' 
-DSHELL -DHAVE_CONFIG_H  -D_FILE_OFFSET_BITS=64  -I. -I/usr/include -I. 
-I./include -I./lib -I/usr/include -O2 -m486 -mcpu=i486 -march=i486 
-D_GNU_SOURCE -Wall -pipe
uname output: Linux hawking 2.4.4-4GB #1 Mon Apr 30 19:59:55 GMT 2001 i686 
unknown
Machine Type: i386-suse-linux

Bash Version: 2.05
Patch Level: 0
Release Status: release

Description:
        The process substitution does not cope properly with closed
        stdin.

Repeat-By:
        $ bash -c 'exec <&-; echo > >(cat >/dev/null)'
        cat: -: Bad file descriptor
        cat: -: Bad file descriptor

Fix:
--- subst.c     2001/05/05 18:00:29     1.1
+++ subst.c     2001/05/05 18:01:00
@@ -3301,7 +3301,8 @@
       exit (127);
     }
 
-  close (fd);
+  if (fd != (open_for_read_in_child ? 0 : 1))
+    close (fd);
 
   /* Need to close any files that this process has open to pipes inherited
      from its parent. */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]