aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-06-05 16:50:08 +0000
committerMatt Kraai <kraai@debian.org>2001-06-05 16:50:08 +0000
commitc616e53ca2d5a46ee5a2b7f272b1b611f01836eb (patch)
treeaaad20944b2a54e3159a24d4a0be9fe52abe0a7f
parentf4dd6e3d1a49c61c0b0463c6414b734cf95c106f (diff)
downloadbusybox-c616e53ca2d5a46ee5a2b7f272b1b611f01836eb.tar.gz
Don't close file descriptors when we are duplicating them.
-rw-r--r--hush.c3
-rw-r--r--shell/hush.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/hush.c b/hush.c
index 372c95753..a58da189c 100644
--- a/hush.c
+++ b/hush.c
@@ -1018,7 +1018,8 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
close(openfd);
} else {
dup2(openfd, redir->fd);
- close(openfd);
+ if (redir->dup == -1)
+ close (openfd);
}
}
}
diff --git a/shell/hush.c b/shell/hush.c
index 372c95753..a58da189c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1018,7 +1018,8 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
close(openfd);
} else {
dup2(openfd, redir->fd);
- close(openfd);
+ if (redir->dup == -1)
+ close (openfd);
}
}
}