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 <zhangshoukui@xiaomi.com>
This commit is contained in:
zhangshoukui 2024-06-05 11:01:04 +08:00 committed by Xiang Xiao
parent ff85c8c0d9
commit 7503f7bf33

View File

@ -25,6 +25,7 @@
#include <nuttx/config.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -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 */