ctrl: Fix fd leak in ctrl_listen()
Use the same pattern for handling rtnl_listen() errors that is used across other iproute2 commands. All other commands exit with status of 2 if rtnl_listen fails. Reported-off-by: Maks Mishin <maks.mishinFZ@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
committed by
Stephen Hemminger
parent
35c0215739
commit
f4dc6a784f
@@ -334,8 +334,9 @@ static int ctrl_listen(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0)
|
if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0)
|
||||||
return -1;
|
exit(2);
|
||||||
|
|
||||||
|
rtnl_close(&rth);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user