Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 03:34:51 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 786639d1950f - stable/13 - libc: popen: slightly simplify cloexec logic
Message-ID:  <202302160334.31G3YpJv043028@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=786639d1950f369faf04fb6617d6ea85dae131a4

commit 786639d1950f369faf04fb6617d6ea85dae131a4
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-02-13 06:33:52 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-02-16 03:29:51 +0000

    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
    
    (cherry picked from commit f123c6c425d4161b06f237996662496abbd78b94)
---
 lib/libc/gen/popen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302160334.31G3YpJv043028>