mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
libc:lib_psfa_dddup2,add return check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
367fa640c1
commit
fcdc7afcb5
1 changed files with 10 additions and 1 deletions
|
@ -89,8 +89,17 @@ int posix_spawn_file_actions_adddup2(
|
|||
/* NOTE: Workaround to avoid an error when executing dup2 action */
|
||||
|
||||
flags = fcntl(fd1, F_GETFD);
|
||||
if (flags < 0)
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
|
||||
flags &= ~FD_CLOEXEC;
|
||||
fcntl(fd1, F_SETFD, flags);
|
||||
flags = fcntl(fd1, F_SETFD, flags);
|
||||
if (flags < 0)
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* And add it to the file action list */
|
||||
|
||||
|
|
Loading…
Reference in a new issue