diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2024-10-16 12:42:02 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2024-10-16 13:30:25 +0200 |
| commit | a67df2a17f69a4e847bad84568f13e1d0fccd02d (patch) | |
| tree | 27439dff3971f2e63293e113b71cfbb8fbb94f26 /lib/netns_linux.c | |
| parent | 40d4a47c0ef47bf4ff659e9c0e57b0a504a5034a (diff) | |
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>
Diffstat (limited to 'lib/netns_linux.c')
| -rw-r--r-- | lib/netns_linux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/netns_linux.c b/lib/netns_linux.c index 8fa4bc6fe0..82162abfd4 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -258,7 +258,7 @@ static void ns_disable_internal(struct ns *ns) if (ns_master.ns_disable_hook) (*ns_master.ns_disable_hook)(ns); - if (have_netns()) + if (have_netns() && ns->fd >= 0) close(ns->fd); ns->fd = -1; |
