From: Petr Písař Date: Wed, 25 Sep 2013 07:45:45 +0000 (+0200) Subject: iproute2: bridge: Close file with bridge monitor file X-Git-Tag: v3.12.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=101847446e6a5e3ca370e65ebc462584934fce0e;p=thirdparty%2Fiproute2.git 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ř --- diff --git a/bridge/monitor.c b/bridge/monitor.c index e96fcaf7a..76e7d477b 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)