summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2011-12-16 13:11:33 -0600
committerJens Axboe <jaxboe@fusionio.com>2012-02-01 13:14:27 +0100
commitf9a89a6f99189f7929278d881de0ce011149d87c (patch)
treece837bd6d631bb7b3740febb1a41feb2c322914e
parent5293cfdbdbc29d34f61f43a9acbdf3468375c68d (diff)
downloadblktrace-f9a89a6f99189f7929278d881de0ce011149d87c.tar.gz
blktrace-f9a89a6f99189f7929278d881de0ce011149d87c.tar.bz2
Close stream in 'I' switch handling
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>
-rw-r--r--blktrace.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/blktrace.c b/blktrace.c
index 49cfca6..228838a 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -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;
}