aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index 07d83689..cf54cdd4 100644
--- a/io.c
+++ b/io.c
@@ -628,8 +628,8 @@ remap_std_file(int oldfd)
if (newfd >= 0) {
/* if oldfd is open, dup2() will close oldfd for us first. */
ret = dup2(newfd, oldfd);
- if (ret == 0)
- close(newfd);
+ // close unconditionally, calling code assumes it
+ close(newfd);
} else
ret = 0;