linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/10] Close stream in 'I' switch handling
@ 2011-12-16 19:11 Eric Sandeen
  0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2011-12-16 19:11 UTC (permalink / raw)
  To: linux-btrace

The file containing the list of devices was never closed
after processing was complete.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/blktrace.c b/blktrace.c
index 848250d..5f74ef2 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;
 		}
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-16 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 19:11 [PATCH 4/10] Close stream in 'I' switch handling Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).