summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/redir.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/sh/redir.c b/bin/sh/redir.c
index f3ad3af..4f0a40c 100644
--- a/bin/sh/redir.c
+++ b/bin/sh/redir.c
@@ -217,8 +217,11 @@ movefd:
if (redir->ndup.dupfd >= 0) { /* if not ">&-" */
if (memory[redir->ndup.dupfd])
memory[fd] = 1;
- else
- dup2(redir->ndup.dupfd, fd);
+ else {
+ if (dup2(redir->ndup.dupfd, fd) < 0)
+ error("%d: %s", redir->ndup.dupfd,
+ strerror(errno));
+ }
} else {
close(fd);
}
OpenPOWER on IntegriCloud