Hi,
I've a bug report that some sub processes report a file descriptor
11 or 12 like here:
ksh> ksh -c 'echo $(ls -l /proc/self/fd)'
total 0
lrwx------ 1 werner suse 64 Feb 27 16:28 0 -> /dev/pts/2
lrwx------ 1 werner suse 64 Feb 27 16:28 1 -> socket:[8675573]
lrwx------ 1 werner suse 64 Feb 27 16:28 11 -> /tmp/sf1e.ipg (deleted)
lrwx------ 1 werner suse 64 Feb 27 16:28 2 -> /dev/pts/2
lr-x------ 1 werner suse 64 Feb 27 16:28 3 -> /proc/27381/fd
ksh> echo 'echo "$(ls -l /proc/self/fd)"' > x
ksh> ksh x
total 0
lrwx------ 1 werner suse 64 Feb 27 16:29 0 -> /dev/pts/2
lrwx------ 1 werner suse 64 Feb 27 16:29 1 -> socket:[8675586]
lrwx------ 1 werner suse 64 Feb 27 16:29 12 -> /tmp/sf12.feh (deleted)
lrwx------ 1 werner suse 64 Feb 27 16:29 2 -> /dev/pts/2
lr-x------ 1 werner suse 64 Feb 27 16:29 3 -> /proc/27383/fd
ksh> rm x
with the attached patch the problem is gone. The only question which
remains: Does this have an side effects (the test suite does not
show any problems).
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2012-02-27 16:06:17.838506198 +0100
@@ -108,6 +108,7 @@ static void iousepipe(Shell_t *shp)
usepipe++;
fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
subpipe[2] = fcntl(1,F_DUPFD,10);
+ fcntl(subpipe[2],F_SETFD,FD_CLOEXEC);
shp->fdstatus[subpipe[2]] = shp->fdstatus[1];
close(1);
fcntl(subpipe[1],F_DUPFD,1);
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers