naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/iproute2-3.11.0-iproute2-bridge-Close-file-with-bridge-monitor-file.patch

5ebd6f
From 101847446e6a5e3ca370e65ebc462584934fce0e Mon Sep 17 00:00:00 2001
5ebd6f
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
5ebd6f
Date: Wed, 25 Sep 2013 09:45:45 +0200
5ebd6f
Subject: [PATCH] iproute2: bridge: Close file with bridge monitor file
5ebd6f
MIME-Version: 1.0
5ebd6f
Content-Type: text/plain; charset=UTF-8
5ebd6f
Content-Transfer-Encoding: 8bit
5ebd6f
5ebd6f
The `bridge monitor file FILENAME' reads dumped netlink messages from
5ebd6f
a file. But it forgot to close the file after using it. This patch
5ebd6f
fixes it.
5ebd6f
5ebd6f
Signed-off-by: Petr Písař <ppisar@redhat.com>
5ebd6f
---
5ebd6f
 bridge/monitor.c | 5 ++++-
5ebd6f
 1 file changed, 4 insertions(+), 1 deletion(-)
5ebd6f
5ebd6f
diff --git a/bridge/monitor.c b/bridge/monitor.c
5ebd6f
index e96fcaf..76e7d47 100644
5ebd6f
--- a/bridge/monitor.c
5ebd6f
+++ b/bridge/monitor.c
5ebd6f
@@ -132,12 +132,15 @@ int do_monitor(int argc, char **argv)
5ebd6f
 
5ebd6f
 	if (file) {
5ebd6f
 		FILE *fp;
5ebd6f
+		int err;
5ebd6f
 		fp = fopen(file, "r");
5ebd6f
 		if (fp == NULL) {
5ebd6f
 			perror("Cannot fopen");
5ebd6f
 			exit(-1);
5ebd6f
 		}
5ebd6f
-		return rtnl_from_file(fp, accept_msg, stdout);
5ebd6f
+		err = rtnl_from_file(fp, accept_msg, stdout);
5ebd6f
+		fclose(fp);
5ebd6f
+		return err;
5ebd6f
 	}
5ebd6f
 
5ebd6f
 	if (rtnl_open(&rth, groups) < 0)
5ebd6f
-- 
5ebd6f
1.8.3.1
5ebd6f