aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2023-02-13 06:33:52 +0000
committerKyle Evans <kevans@FreeBSD.org>2023-02-13 06:33:57 +0000
commitf123c6c425d4161b06f237996662496abbd78b94 (patch)
tree5aa6ef153496efffd2285b774362b0293c06c2ec /lib/libc/gen
parent8d78a0d331ec2c168efe6cb85bbc2da86e9a6124 (diff)
downloadsrc-f123c6c425d4161b06f237996662496abbd78b94.tar.gz
src-f123c6c425d4161b06f237996662496abbd78b94.zip
libc: popen: slightly simplify cloexec logic
No need to check the mode again here; we know that `iop` wraps the correct fd. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D37987
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/popen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 4f94405c2ff4..c5373077f3ae 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -181,7 +181,7 @@ popen(const char *command, const char *type)
* the list which will cause an explicit close.
*/
if (!cloexec)
- (void)_fcntl(*type == 'r' ? pdes[0] : pdes[1], F_SETFD, 0);
+ (void)_fcntl(fileno(iop), F_SETFD, 0);
return (iop);
}