From 80de2f7c9bc519fb820033a530e1657977117a33 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 22 Feb 2022 20:12:28 +0200 Subject: Fix resource links found by Coverity. --- io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'io.c') 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; -- cgit v1.2.3