Close stream in 'I' switch handling
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Dec 2011 19:11:33 +0000 (13:11 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 1 Feb 2012 12:14:27 +0000 (13:14 +0100)
The file containing the list of devices was never closed
after processing was complete.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
blktrace.c

index 49cfca61352ddca5233f669e76edb1bea54f84e2..228838af1758954ea8bf8d24d9ea71c224d9884c 100644 (file)
@@ -2076,9 +2076,13 @@ static int handle_args(int argc, char *argv[])
                                return 1;
                        }
 
-                       while (fscanf(ifp, "%s\n", dev_line) == 1)
-                               if (add_devpath(dev_line) != 0)
+                       while (fscanf(ifp, "%s\n", dev_line) == 1) {
+                               if (add_devpath(dev_line) != 0) {
+                                       fclose(ifp);
                                        return 1;
+                               }
+                       }
+                       fclose(ifp);
                        break;
                }