From 7503f7bf330901dd290fb48bcdaff2b27e39377f Mon Sep 17 00:00:00 2001 From: zhangshoukui Date: Wed, 5 Jun 2024 11:01:04 +0800 Subject: [PATCH] popen: Replace fcntl with ioctl The fcntl interface sets the O_CLOEXEC property by calling the ioctl interface. Let's call the ioctl interface directly. Signed-off-by: zhangshoukui --- system/popen/popen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/popen/popen.c b/system/popen/popen.c index 254f86ae6..a873f3864 100644 --- a/system/popen/popen.c +++ b/system/popen/popen.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -322,7 +323,7 @@ FILE *popen(FAR const char *command, FAR const char *mode) if (strchr(mode, 'e') == NULL) { - fcntl(retfd, F_SETFD, 0); + ioctl(retfd, FIOCLEX, 0); } /* Finale and return input input/output stream */