Skip to contentSkip to conversation

iproute2: bridge: Close file with bridge monitor file

PATCH Applied Petr Písař 2 participants 2 messages Sep 25, 2013 – Oct 1, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 bridge/monitor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bridge/monitor.c +4 -1
index e96fcaf..76e7d47 100644
@@ -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)
Signature · 1 line
1.8.3.1