aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-08-16 08:38:34 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-08-16 08:38:34 +0000
commit298e9952ade648380a5612c058cb7ede7051c561 (patch)
treeff3b46509a10ed268c99c563bc7db45d6afc2169 /shell
parent1033e21ab7835793dad65f502bceb39c8dc1b9df (diff)
downloadbusybox-w32-298e9952ade648380a5612c058cb7ede7051c561.tar.gz
busybox-w32-298e9952ade648380a5612c058cb7ede7051c561.tar.bz2
busybox-w32-298e9952ade648380a5612c058cb7ede7051c561.zip
Joe.C writes:
This bug is in busybox 1.0.0-rc2. When using lash exec builtin with redirection, the opened file fd keep increasing. For example, please try the following command with lash. ls -al /proc/<lash pid>/fd exec /bin/sh 2>/dev/null ls -al /proc/<lash pid>/fd The last 'ls' command output will look like this. The fd number 4 shouldn't exist. lrwx------ 1 501 100 64 Aug 13 13:56 4 -> /dev/pts/5 l-wx------ 1 501 100 64 Aug 13 13:56 2 -> /dev/null lrwx------ 1 501 100 64 Aug 13 13:56 1 -> /dev/pts/5 lrwx------ 1 501 100 64 Aug 13 13:56 0 -> /dev/pts/5 dr-xr-xr-x 3 501 100 0 Aug 13 13:56 .. dr-x------ 2 501 100 0 Aug 13 13:56 . This one-line patch fix this problem by setting CLOEXEC flag for squirrel fd. Please apply. Joe.C git-svn-id: svn://busybox.net/trunk/busybox@9100 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
-rw-r--r--shell/lash.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/shell/lash.c b/shell/lash.c
index fa416c742..f454e6990 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -656,6 +656,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
656 if (openfd != redir->fd) { 656 if (openfd != redir->fd) {
657 if (squirrel && redir->fd < 3) { 657 if (squirrel && redir->fd < 3) {
658 squirrel[redir->fd] = dup(redir->fd); 658 squirrel[redir->fd] = dup(redir->fd);
659 fcntl (squirrel[redir->fd], F_SETFD, FD_CLOEXEC);
659 } 660 }
660 dup2(openfd, redir->fd); 661 dup2(openfd, redir->fd);
661 close(openfd); 662 close(openfd);