[iproute] Close file with bridge monitor file

Petr Pisar ppisar at fedoraproject.org
Tue Oct 1 14:05:27 UTC 2013


commit 34466f116e2f071b60cd4760e922bbbdb3304fba
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Oct 1 16:04:26 2013 +0200

    Close file with bridge monitor file

 iproute.spec                                       |    8 +++-
 ...ridge-Close-file-with-bridge-monitor-file.patch |   41 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/iproute.spec b/iproute.spec
index 3d04026..c6843a8 100644
--- a/iproute.spec
+++ b/iproute.spec
@@ -2,7 +2,7 @@
 Summary:            Advanced IP routing and network device configuration tools
 Name:               iproute
 Version:            3.10.0
-Release:            7%{?dist}
+Release:            8%{?dist}
 Group:              Applications/System
 URL:                http://kernel.org/pub/linux/utils/net/%{name}2/
 Source0:            http://kernel.org/pub/linux/utils/net/%{name}2/%{name}2-%{version}.tar.gz
@@ -23,6 +23,8 @@ Patch11:            iproute2-3.10.0-rtnl_send.patch
 # Rejected by upstream <http://thread.gmane.org/gmane.linux.network/284101>
 Patch12:            iproute2-3.11.0-tc-ok.patch
 Patch13:            iproute2-3.11.0-iproute2-bridge-document-mdb.patch
+# Bug #1011822, in upstream after 3.11.0
+Patch14:            iproute2-3.11.0-iproute2-bridge-Close-file-with-bridge-monitor-file.patch
 License:            GPLv2+ and Public Domain
 BuildRequires:      bison
 BuildRequires:      flex
@@ -81,6 +83,7 @@ The libnetlink static library.
 %patch11 -p1 -b .rtnl_send
 %patch12 -p1 -b .tc_ok
 %patch13 -p1 -b .bridge_mdb_doc
+%patch14 -p1 -b .bridge_monitor_close
 sed -i 's/^LIBDIR=/LIBDIR?=/' Makefile
 
 %build
@@ -180,6 +183,9 @@ done
 %{_includedir}/libnetlink.h
 
 %changelog
+* Tue Oct 01 2013 Petr Pisar <ppisar at redhat.com> - 3.10.0-8
+- Close file with bridge monitor file (bug #1011822)
+
 * Tue Sep 24 2013 Petr Pisar <ppisar at redhat.com> - 3.10.0-7
 - Add tc -OK option
 - Document "bridge mdb" and "bridge monitor mdb"
diff --git a/iproute2-3.11.0-iproute2-bridge-Close-file-with-bridge-monitor-file.patch b/iproute2-3.11.0-iproute2-bridge-Close-file-with-bridge-monitor-file.patch
new file mode 100644
index 0000000..8d381a4
--- /dev/null
+++ b/iproute2-3.11.0-iproute2-bridge-Close-file-with-bridge-monitor-file.patch
@@ -0,0 +1,41 @@
+From 101847446e6a5e3ca370e65ebc462584934fce0e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 25 Sep 2013 09:45:45 +0200
+Subject: [PATCH] iproute2: bridge: Close file with bridge monitor file
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The `bridge monitor file FILENAME' reads dumped netlink messages from
+a file. But it forgot to close the file after using it. This patch
+fixes it.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ bridge/monitor.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/bridge/monitor.c b/bridge/monitor.c
+index e96fcaf..76e7d47 100644
+--- a/bridge/monitor.c
++++ b/bridge/monitor.c
+@@ -132,12 +132,15 @@ int do_monitor(int argc, char **argv)
+ 
+ 	if (file) {
+ 		FILE *fp;
++		int err;
+ 		fp = fopen(file, "r");
+ 		if (fp == NULL) {
+ 			perror("Cannot fopen");
+ 			exit(-1);
+ 		}
+-		return rtnl_from_file(fp, accept_msg, stdout);
++		err = rtnl_from_file(fp, accept_msg, stdout);
++		fclose(fp);
++		return err;
+ 	}
+ 
+ 	if (rtnl_open(&rth, groups) < 0)
+-- 
+1.8.3.1
+


More information about the scm-commits mailing list