sched/task: ignore return value of nxspawn_close()

Closing an invalid file descriptor will not cause the action fail.

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-11-16 13:49:03 +08:00 committed by Xiang Xiao
parent 8a479cc2ca
commit 342a6bb676

View File

@ -58,14 +58,15 @@
* *
****************************************************************************/ ****************************************************************************/
static inline int nxspawn_close(FAR struct tcb_s *tcb, static inline void
FAR struct spawn_close_file_action_s *action) nxspawn_close(FAR struct tcb_s *tcb,
FAR struct spawn_close_file_action_s *action)
{ {
/* The return value from nx_close() is ignored */ /* The return value from nx_close() is ignored */
sinfo("Closing fd=%d\n", action->fd); sinfo("Closing fd=%d\n", action->fd);
return nx_close_from_tcb(tcb, action->fd); nx_close_from_tcb(tcb, action->fd);
} }
static inline int nxspawn_dup2(FAR struct tcb_s *tcb, static inline int nxspawn_dup2(FAR struct tcb_s *tcb,
@ -268,7 +269,13 @@ int spawn_file_actions(FAR struct tcb_s *tcb,
switch (entry->action) switch (entry->action)
{ {
case SPAWN_FILE_ACTION_CLOSE: case SPAWN_FILE_ACTION_CLOSE:
ret = nxspawn_close(tcb, (FAR void *)entry);
/* Ignore return value of nxspawn_close(),
* Closing an invalid file descriptor will
* not cause the action fail.
*/
nxspawn_close(tcb, (FAR void *)entry);
break; break;
case SPAWN_FILE_ACTION_DUP2: case SPAWN_FILE_ACTION_DUP2: