aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-02-22 20:15:04 +0200
committerArnold D. Robbins <arnold@skeeve.com>2022-02-22 20:15:04 +0200
commitfa4cc1fb8ba39038e7ee1eba3b9d08bfeddb1f37 (patch)
tree8b84a00505dd10d43b4422e66c44a257681e4086 /io.c
parent8d9d0c5ba78546704658351d2d8e9aa626bb0383 (diff)
parent80de2f7c9bc519fb820033a530e1657977117a33 (diff)
downloadegawk-fa4cc1fb8ba39038e7ee1eba3b9d08bfeddb1f37.tar.gz
egawk-fa4cc1fb8ba39038e7ee1eba3b9d08bfeddb1f37.tar.bz2
egawk-fa4cc1fb8ba39038e7ee1eba3b9d08bfeddb1f37.zip
Merge branch 'gawk-5.1-stable'
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;