From: "Petr Písař" <ppisar@redhat.com>
To: <netdev@vger.kernel.org>
Cc: "Stephen Hemminger" <stephen@networkplumber.org>,
"Petr Písař" <ppisar@redhat.com>
Subject: [PATCH] iproute2: bridge: Close file with bridge monitor file
Date: Wed, 25 Sep 2013 09:45:45 +0200 [thread overview]
Message-ID: <1380095145-6618-1-git-send-email-ppisar@redhat.com> (raw)
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
next reply other threads:[~2013-09-25 7:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 7:45 Petr Písař [this message]
2013-10-01 4:11 ` [PATCH] iproute2: bridge: Close file with bridge monitor file Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1380095145-6618-1-git-send-email-ppisar@redhat.com \
--to=ppisar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).