cansniffer: unify setsockopt error handling

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
pull/486/head
Oliver Hartkopp 2023-12-08 17:12:16 +01:00
parent 7affaf217e
commit c31addfa9c
1 changed files with 5 additions and 1 deletions

View File

@ -302,7 +302,11 @@ int main(int argc, char **argv)
goto out; goto out;
} }
setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts)); if (setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts)) < 0) {
perror("setsockopt");
r = 1;
goto out;
}
if ((llopts.mtu) && (setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_LL_OPTS, &llopts, sizeof(llopts))) < 0) { if ((llopts.mtu) && (setsockopt(s, SOL_CAN_ISOTP, CAN_ISOTP_LL_OPTS, &llopts, sizeof(llopts))) < 0) {
perror("setsockopt"); perror("setsockopt");