netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iproute2: bridge: Close file with bridge monitor file
@ 2013-09-25  7:45 Petr Písař
  2013-10-01  4:11 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Písař @ 2013-09-25  7:45 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Petr Písař

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@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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iproute2: bridge: Close file with bridge monitor file
  2013-09-25  7:45 [PATCH] iproute2: bridge: Close file with bridge monitor file Petr Písař
@ 2013-10-01  4:11 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2013-10-01  4:11 UTC (permalink / raw)
  To: Petr Písař; +Cc: netdev

On Wed, 25 Sep 2013 09:45:45 +0200
Petr Písař <ppisar@redhat.com> wrote:

> 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@redhat.com>

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-01  4:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25  7:45 [PATCH] iproute2: bridge: Close file with bridge monitor file Petr Písař
2013-10-01  4:11 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).