lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1439521013-22260-2-git-send-email-zhangshengju@cmss.chinamobile.com>
Date:	Fri, 14 Aug 2015 02:56:52 +0000
From:	Zhang Shengju <zhangshengju@...s.chinamobile.com>
To:	netdev@...r.kernel.org
Subject: [PATCH iproute2 1/2] libs: close file in netns_switch()

Add mising close() calls.

Signed-off-by: Zhang Shengju <zhangshengju@...s.chinamobile.com>
---
 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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ