From 0c9d0b3f8481b27db6a55fc2d0682aedfbbe3587 Mon Sep 17 00:00:00 2001 From: p-szafonimateusz Date: Tue, 16 Sep 2025 13:12:10 +0200 Subject: [PATCH] sched/sig_pending: sigpending() should return caller pending signals only Previously sigpending() returned all pending signals in the group, which is not POSIX compliant. It should return signals pending only for the caller, so a signal send with pthread_kill() intended for another thread should not be returned (it's not pending for a caller). This fixes the pthread_create.c/test9 test case from PSE52 Open Group Threads Test Suite. Signed-off-by: p-szafonimateusz --- sched/signal/sig_pending.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sched/signal/sig_pending.c b/sched/signal/sig_pending.c index ace8f79bf4..c1e5fe9aeb 100644 --- a/sched/signal/sig_pending.c +++ b/sched/signal/sig_pending.c @@ -86,13 +86,10 @@ sigset_t nxsig_pendingset(FAR struct tcb_s *stcb) if (stcb == NULL) { - group = this_task()->group; - } - else - { - group = stcb->group; + stcb = this_task(); } + group = stcb->group; DEBUGASSERT(group); sigemptyset(&sigpendset); @@ -101,7 +98,7 @@ sigset_t nxsig_pendingset(FAR struct tcb_s *stcb) for (sigpend = (FAR sigpendq_t *)group->tg_sigpendingq.head; (sigpend); sigpend = sigpend->flink) { - if (stcb == NULL || sigpend->tcb == NULL || stcb == sigpend->tcb) + if (sigpend->tcb == NULL || stcb == sigpend->tcb) { nxsig_addset(&sigpendset, sigpend->info.si_signo); }