aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-02-22 20:12:28 +0200
committerArnold D. Robbins <arnold@skeeve.com>2022-02-22 20:12:28 +0200
commit80de2f7c9bc519fb820033a530e1657977117a33 (patch)
treee0b8b01efe8040cdb7b5039d17aa93a85bc0b442 /io.c
parent938afb4d7acb9974d5789dfe4e322c0ccce0541e (diff)
downloadegawk-80de2f7c9bc519fb820033a530e1657977117a33.tar.gz
egawk-80de2f7c9bc519fb820033a530e1657977117a33.tar.bz2
egawk-80de2f7c9bc519fb820033a530e1657977117a33.zip
Fix resource links found by Coverity.
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;