mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
fs/dup3: impletement dup3/nx_dup3_from_tcb function
refs: https://man7.org/linux/man-pages/man2/dup.2.html Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
@@ -175,7 +176,8 @@ static void local_recvctl(FAR struct local_conn_s *conn,
|
||||
count = peer->lc_cfpcount;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
fds[i] = file_dup(peer->lc_cfps[i], 0, !!(flags & MSG_CMSG_CLOEXEC));
|
||||
fds[i] = file_dup(peer->lc_cfps[i], 0,
|
||||
flags & MSG_CMSG_CLOEXEC ? O_CLOEXEC : 0);
|
||||
file_close(peer->lc_cfps[i]);
|
||||
kmm_free(peer->lc_cfps[i]);
|
||||
peer->lc_cfps[i] = NULL;
|
||||
|
||||
Reference in New Issue
Block a user