signals: collect_signal: simplify the "still_pending" logic
Factor out sigdelset() calls and remove the "still_pending" variable. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6715ca451c
commit
d443420761
1 changed files with 6 additions and 9 deletions
|
@ -341,7 +341,6 @@ unblock_all_signals(void)
|
||||||
static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
|
static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
|
||||||
{
|
{
|
||||||
struct sigqueue *q, *first = NULL;
|
struct sigqueue *q, *first = NULL;
|
||||||
int still_pending = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collect the siginfo appropriate to this signal. Check if
|
* Collect the siginfo appropriate to this signal. Check if
|
||||||
|
@ -349,26 +348,24 @@ static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
|
||||||
*/
|
*/
|
||||||
list_for_each_entry(q, &list->list, list) {
|
list_for_each_entry(q, &list->list, list) {
|
||||||
if (q->info.si_signo == sig) {
|
if (q->info.si_signo == sig) {
|
||||||
if (first) {
|
if (first)
|
||||||
still_pending = 1;
|
goto still_pending;
|
||||||
break;
|
|
||||||
}
|
|
||||||
first = q;
|
first = q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sigdelset(&list->signal, sig);
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
|
still_pending:
|
||||||
list_del_init(&first->list);
|
list_del_init(&first->list);
|
||||||
copy_siginfo(info, &first->info);
|
copy_siginfo(info, &first->info);
|
||||||
__sigqueue_free(first);
|
__sigqueue_free(first);
|
||||||
if (!still_pending)
|
|
||||||
sigdelset(&list->signal, sig);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Ok, it wasn't in the queue. This must be
|
/* Ok, it wasn't in the queue. This must be
|
||||||
a fast-pathed signal or we must have been
|
a fast-pathed signal or we must have been
|
||||||
out of queue space. So zero out the info.
|
out of queue space. So zero out the info.
|
||||||
*/
|
*/
|
||||||
sigdelset(&list->signal, sig);
|
|
||||||
info->si_signo = sig;
|
info->si_signo = sig;
|
||||||
info->si_errno = 0;
|
info->si_errno = 0;
|
||||||
info->si_code = 0;
|
info->si_code = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue