zebra: close fd when not needed

Upon decision that the vrf is not going to be supported
by namespaces close the fd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-03-20 19:14:18 -04:00
parent 267bf505c5
commit 4307629f18

View File

@ -349,8 +349,10 @@ ns_id_t zebra_ns_id_get_default(void)
if (fd == -1)
return NS_DEFAULT_INTERNAL;
if (!vrf_is_backend_netns())
if (!vrf_is_backend_netns()) {
close(fd);
return NS_DEFAULT_INTERNAL;
}
close(fd);
return zebra_ns_id_get((char *)NS_DEFAULT_NAME);
#else /* HAVE_NETNS */