forked from Mirror/frr
lib: guard close() in netns code
clang-SA complains that ns->fd could be invalid. Add a guard. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
40d4a47c0e
commit
a67df2a17f
|
@ -258,7 +258,7 @@ static void ns_disable_internal(struct ns *ns)
|
||||||
if (ns_master.ns_disable_hook)
|
if (ns_master.ns_disable_hook)
|
||||||
(*ns_master.ns_disable_hook)(ns);
|
(*ns_master.ns_disable_hook)(ns);
|
||||||
|
|
||||||
if (have_netns())
|
if (have_netns() && ns->fd >= 0)
|
||||||
close(ns->fd);
|
close(ns->fd);
|
||||||
|
|
||||||
ns->fd = -1;
|
ns->fd = -1;
|
||||||
|
|
Loading…
Reference in a new issue