canbusload: main(): switch from pselect() to select()

We don't need to block any signals, so a select() is sufficient. This
also fixes the problem that sigmask is uninitialized and may block the
sig ARLM, which make canbusload hang until a CAN frame is recieved.

Closes: https://github.com/linux-can/can-utils/issues/465
pull/466/head
Marc Kleine-Budde 2023-10-06 12:27:55 +02:00
parent c5b64802a1
commit 8e2caa8f8a
1 changed files with 1 additions and 5 deletions

View File

@ -251,7 +251,6 @@ int main(int argc, char **argv)
struct canfd_frame frame; struct canfd_frame frame;
int nbytes, i; int nbytes, i;
struct ifreq ifr; struct ifreq ifr;
sigset_t sigmask, savesigmask;
signal(SIGTERM, sigterm); signal(SIGTERM, sigterm);
signal(SIGHUP, sigterm); signal(SIGHUP, sigterm);
@ -392,11 +391,8 @@ int main(int argc, char **argv)
for (i = 0; i < currmax; i++) for (i = 0; i < currmax; i++)
FD_SET(s[i], &rdfs); FD_SET(s[i], &rdfs);
savesigmask = sigmask; if (select(s[currmax - 1] + 1, &rdfs, NULL, NULL, NULL) < 0) {
if (pselect(s[currmax - 1] + 1, &rdfs, NULL, NULL, NULL, &sigmask) < 0) {
//perror("pselect"); //perror("pselect");
sigmask = savesigmask;
continue; continue;
} }