aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-10-12 08:52:12 -0700
committerDamjan Marion <dmarion@me.com>2021-10-13 14:30:41 +0000
commit807868da3cdb0ade4a796289dab18454edef5407 (patch)
treeee2a0166f30b696e6cabfec5c3bb3af97c8a0b38
parent3b7003b58a8519cc49c17e9883d418c0fb5db9fa (diff)
vppinfra: fix socket init netns coverity
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4f37c6601ace08ae886b08d2284b413d457e4eae
-rw-r--r--src/vppinfra/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index 2921e008018..a09a390dab3 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -563,6 +563,9 @@ clib_socket_init_netns (clib_socket_t *s, u8 *namespace)
int old_netns_fd, nfd = -1;
old_netns_fd = clib_netns_open (NULL /* self */);
+ if (old_netns_fd < 0)
+ return clib_error_return_unix (0, "get current netns failed");
+
if ((nfd = clib_netns_open (namespace)) == -1)
{
error = clib_error_return_unix (0, "clib_netns_open '%s'", namespace);