mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 14:29:54 +02:00
Added program exit on SIOCGIFINDEX error.
This commit is contained in:
@@ -198,8 +198,10 @@ int main(int argc, char **argv)
|
|||||||
addr.can_family = AF_CAN;
|
addr.can_family = AF_CAN;
|
||||||
|
|
||||||
strcpy(ifr.ifr_name, argv[optind]);
|
strcpy(ifr.ifr_name, argv[optind]);
|
||||||
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0)
|
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
perror("SIOCGIFINDEX");
|
perror("SIOCGIFINDEX");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
addr.can_ifindex = ifr.ifr_ifindex;
|
addr.can_ifindex = ifr.ifr_ifindex;
|
||||||
|
|
||||||
/* disable default receive filter on this RAW socket */
|
/* disable default receive filter on this RAW socket */
|
||||||
|
|||||||
Reference in New Issue
Block a user