change socket to O_NONBLOCK

This commit is contained in:
smayzy 2026-04-11 15:29:16 +02:00
parent 25d8136d74
commit 1993006247

View File

@ -10,6 +10,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <fcntl.h>
const int digit_bitmaps[10][5][3] = { const int digit_bitmaps[10][5][3] = {
{{1,1,1},{1,0,1},{1,0,1},{1,0,1},{1,1,1}}, // 0 {{1,1,1},{1,0,1},{1,0,1},{1,0,1},{1,1,1}}, // 0
@ -394,6 +395,7 @@ int main(int argc, char **argv) {
perror("socket error"); perror("socket error");
return 1; return 1;
} }
fcntl(soc, F_SETFL, O_NONBLOCK);
strcpy(ifr.ifr_name, "can0"); strcpy(ifr.ifr_name, "can0");
ioctl(soc, SIOCGIFINDEX, &ifr); ioctl(soc, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN; addr.can_family = AF_CAN;