Add mising close() calls.
Signed-off-by: Zhang Shengju <[email protected]>
---
lib/namespace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/namespace.c b/lib/namespace.c
index 8197165..025ed47 100644
--- a/lib/namespace.c
+++ b/lib/namespace.c
@@ -45,7 +45,7 @@ static void bind_etc(const char *name)
int netns_switch(char *name)
{
char net_path[PATH_MAX];
- int netns;
+ int netns, ret = -1;
snprintf(net_path, sizeof(net_path), "%s/%s", NETNS_RUN_DIR, name);
netns = open(net_path, O_RDONLY | O_CLOEXEC);
@@ -83,10 +83,10 @@ int netns_switch(char *name)
/* Setup bind mounts for config files in /etc */
bind_etc(name);
- return 0;
+ ret = 0;
fail_close:
close(netns);
- return -1;
+ return ret;
}
int netns_get_fd(const char *name)
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html