close soc if ioctl fails
This commit is contained in:
parent
836a0b52c4
commit
5aa878d289
@ -395,6 +395,7 @@ int main(int argc, char **argv) {
|
|||||||
strcpy(ifr.ifr_name, "can0");
|
strcpy(ifr.ifr_name, "can0");
|
||||||
if (ioctl(soc, SIOCGIFINDEX, &ifr) < 0) {
|
if (ioctl(soc, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
perror("ioctl error");
|
perror("ioctl error");
|
||||||
|
close(soc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
addr.can_family = AF_CAN;
|
addr.can_family = AF_CAN;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user