[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1439521013-22260-3-git-send-email-zhangshengju@cmss.chinamobile.com>
Date: Fri, 14 Aug 2015 02:56:53 +0000
From: Zhang Shengju <zhangshengju@...s.chinamobile.com>
To: netdev@...r.kernel.org
Subject: [PATCH iproute2 2/2] netns: add missing file close
Add missing file close.
Signed-off-by: Zhang Shengju <zhangshengju@...s.chinamobile.com>
---
ip/ipnetns.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 088096f..d1af0c6 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -462,8 +462,10 @@ static int netns_pids(int argc, char **argv)
if (fstat(netns, &netst) < 0) {
fprintf(stderr, "Stat of netns failed: %s\n",
strerror(errno));
+ close(netns);
return -1;
}
+ close(netns);
dir = opendir("/proc/");
if (!dir) {
fprintf(stderr, "Open of /proc failed: %s\n",
@@ -522,8 +524,10 @@ static int netns_identify(int argc, char **argv)
if (fstat(netns, &netst) < 0) {
fprintf(stderr, "Stat of netns failed: %s\n",
strerror(errno));
+ close(netns);
return -1;
}
+ close(netns);
dir = opendir(NETNS_RUN_DIR);
if (!dir) {
/* Succeed treat a missing directory as an empty directory */
@@ -728,6 +732,7 @@ static int netns_set(int argc, char **argv)
name, strerror(errno));
return -1;
}
+ close(netns);
return set_netnsid_from_name(name, nsid);
}
--
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