summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Písař <ppisar@redhat.com>2013-09-25 09:45:45 +0200
committerStephen Hemminger <stephen@networkplumber.org>2013-09-30 21:00:06 -0700
commit101847446e6a5e3ca370e65ebc462584934fce0e (patch)
treeb1e0c7222a81137f13559b3061562b76e2e0d2db
parentf3abcfed464b16b1149992b7ecdca585d3b7838d (diff)
downloadiproute2-101847446e6a5e3ca370e65ebc462584934fce0e.tar.gz
iproute2: bridge: Close file with bridge monitor file
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>
-rw-r--r--bridge/monitor.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bridge/monitor.c b/bridge/monitor.c
index e96fcaf7..76e7d477 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)