From 8e2caa8f8a8d100d811e84a9c19560326d9f3455 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 6 Oct 2023 12:27:55 +0200 Subject: [PATCH] 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 --- canbusload.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/canbusload.c b/canbusload.c index b4861ce..4409a4b 100644 --- a/canbusload.c +++ b/canbusload.c @@ -251,7 +251,6 @@ int main(int argc, char **argv) struct canfd_frame frame; int nbytes, i; struct ifreq ifr; - sigset_t sigmask, savesigmask; signal(SIGTERM, sigterm); signal(SIGHUP, sigterm); @@ -392,11 +391,8 @@ int main(int argc, char **argv) for (i = 0; i < currmax; i++) FD_SET(s[i], &rdfs); - savesigmask = sigmask; - - if (pselect(s[currmax - 1] + 1, &rdfs, NULL, NULL, NULL, &sigmask) < 0) { + if (select(s[currmax - 1] + 1, &rdfs, NULL, NULL, NULL) < 0) { //perror("pselect"); - sigmask = savesigmask; continue; }