Skip to content

Commit

Permalink
canbusload: main(): switch from pselect() to select()
Browse files Browse the repository at this point in the history
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: linux-can#465
  • Loading branch information
marckleinebudde committed Oct 6, 2023
1 parent c5b6480 commit 8e2caa8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions canbusload.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 8e2caa8

Please sign in to comment.