cansequence: cleanup perror() and exit()

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
pull/254/head^2
Marc Kleine-Budde 2014-03-22 20:17:49 +01:00
parent 7975f9859c
commit 985121aaad
1 changed files with 7 additions and 7 deletions

View File

@ -265,27 +265,27 @@ int main(int argc, char **argv)
s = socket(family, type, proto); s = socket(family, type, proto);
if (s < 0) { if (s < 0) {
perror("socket"); perror("socket()");
return 1; exit(EXIT_FAILURE);
} }
addr.can_family = family; addr.can_family = family;
strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name)); strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFINDEX, &ifr)) { if (ioctl(s, SIOCGIFINDEX, &ifr)) {
perror("ioctl"); perror("ioctl()");
return 1; exit(EXIT_FAILURE);
} }
addr.can_ifindex = ifr.ifr_ifindex; addr.can_ifindex = ifr.ifr_ifindex;
/* first don't recv. any msgs */ /* first don't recv. any msgs */
if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0)) { if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0)) {
perror("setsockopt"); perror("setsockopt()");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
perror("bind"); perror("bind()");
return 1; exit(EXIT_FAILURE);
} }
if (receive) if (receive)