isotpsniffer: fix error handling, "0" is a valid filedescriptor
Fixes: b04108c615 ("isotpsniffer: Fix error handling")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
pull/177/head
parent
9ae877ce32
commit
b6a44803fd
|
|
@ -177,7 +177,7 @@ void printbuf(unsigned char *buffer, int nbytes, int color, int timestamp,
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
fd_set rdfs;
|
fd_set rdfs;
|
||||||
int s = 0, t = 0;
|
int s = -1, t = -1;
|
||||||
struct sockaddr_can addr;
|
struct sockaddr_can addr;
|
||||||
char if_name[IFNAMSIZ];
|
char if_name[IFNAMSIZ];
|
||||||
static struct can_isotp_options opts;
|
static struct can_isotp_options opts;
|
||||||
|
|
@ -392,9 +392,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (s)
|
if (s != -1)
|
||||||
close(s);
|
close(s);
|
||||||
if (t)
|
if (t != -1)
|
||||||
close(t);
|
close(t);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue