aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-02-22 20:36:31 +0200
committerArnold D. Robbins <arnold@skeeve.com>2022-02-22 20:36:31 +0200
commitcbe60ef06e7394db11170d19f900b023142c7431 (patch)
treee3e3d892764e05080ca75798b268969212b091c5 /io.c
parentd43ef1c772bdb5993138aed523e058664594f3e6 (diff)
parentd330a2bdc9d6892dc55ce8f5d299196f32ab1003 (diff)
downloadegawk-cbe60ef06e7394db11170d19f900b023142c7431.tar.gz
egawk-cbe60ef06e7394db11170d19f900b023142c7431.tar.bz2
egawk-cbe60ef06e7394db11170d19f900b023142c7431.zip
Merge branch 'master' into feature/readall
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;