summaryrefslogtreecommitdiffstats
path: root/src/plugins/linux-cp
diff options
context:
space:
mode:
authorPim van Pelt <pim@ipng.nl>2022-01-28 14:29:21 +0000
committerMatthew Smith <mgsmith@netgate.com>2022-01-28 16:46:12 +0000
commit307ff11acbe811b7834f58a5bd14dd3038c991cd (patch)
tree556bdf9e864523cbba93e5a1d9fbb650cc006ce0 /src/plugins/linux-cp
parent15d0215b9ca91f4964ba3a5528b1f38f84aaf158 (diff)
linux-cp: Fix coverity issue
Type: fix Possible negative return in open(), do not use curr_ns_fd if it is negative. Addresses Coverity issue 248535 Signed-off-by: Pim van Pelt <pim@ipng.nl> Change-Id: I8429ede0f1fe9fe6619e3c4dbd83adb620ea62c2
Diffstat (limited to 'src/plugins/linux-cp')
-rw-r--r--src/plugins/linux-cp/lcp_nl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/linux-cp/lcp_nl.c b/src/plugins/linux-cp/lcp_nl.c
index 8a55f4c5edd..1c0ca0d5cd5 100644
--- a/src/plugins/linux-cp/lcp_nl.c
+++ b/src/plugins/linux-cp/lcp_nl.c
@@ -496,7 +496,7 @@ lcp_nl_open_socket (void)
nl_connect (nm->sk_route, NETLINK_ROUTE);
- if (dest_ns_fd)
+ if (dest_ns_fd && curr_ns_fd >= 0)
{
setns (curr_ns_fd, CLONE_NEWNET);
close (curr_ns_fd);