Extraneous test in setsignal()?
Denys Vlasenko <[email protected]> Tue, 27 Jan 2026 05:31:37 +0100
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <CAK1hOcN3qdr0ee_Ny0syn_eS6dh6yK59AYX8PgamV20P-MXFaQ@mail.gmail.com> |
void setsignal(int signo)
{
...
if ((t = trap[signo]) == NULL)
action = S_DFL;
else if (*t != '\0')
action = S_CATCH;
else
action = S_IGN;
if (rootshell && action == S_DFL && !lvforked) {
...
If you read the above carefully, you see that action == S_DFL check
can be eliminated if we rewrite the above like this:
new_act = S_DFL;
if ((t = trap[signo]) != NULL)
new_act = S_CATCH;
if (t[0] == '\0')
new_act = S_IGN;
} else if (rootshell && !lvforked) {
...