close soc if ioctl fails

This commit is contained in:
smayzy 2026-04-11 16:49:46 +02:00
parent 836a0b52c4
commit 5aa878d289

View File

@ -395,6 +395,7 @@ int main(int argc, char **argv) {
strcpy(ifr.ifr_name, "can0");
if (ioctl(soc, SIOCGIFINDEX, &ifr) < 0) {
perror("ioctl error");
close(soc);
return 1;
}
addr.can_family = AF_CAN;