]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iproute2: bridge: Close file with bridge monitor file
authorPetr Písař <ppisar@redhat.com>
Wed, 25 Sep 2013 07:45:45 +0000 (09:45 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 1 Oct 2013 04:00:06 +0000 (21:00 -0700)
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

index e96fcaf7ae676d5092584e5883668e490ecc11ad..76e7d477be662a59339e501bd59c89f33c07c8aa 100644 (file)
@@ -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)