summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}