git » libjio » commit 20980b0

In jfsck() I forgot to close three files (well, two and a directory really); this patch closes them.

author Alberto Bertogli
2004-05-05 18:08:13 UTC
committer Alberto Bertogli
2007-07-15 12:44:27 UTC
parent e2b19449d9008862454f35fac10f43aeb2b11454

In jfsck() I forgot to close three files (well, two and a directory really); this patch closes them.

In jfsck() I forgot to close three files (well, two and a directory really);
this patch closes them.

Thanks to Pieter Grimmerink for reporting.

libjio.c +4 -0

diff --git a/libjio.c b/libjio.c
index a0a7e7b..4372be4 100644
--- a/libjio.c
+++ b/libjio.c
@@ -732,6 +732,7 @@ int jfsck(char *name, struct jfsck_result *res)
 		if (rv > maxtid)
 			maxtid = rv;
 	}
+	closedir(dir);
 
 	/* we loop all the way up to the max transaction id */
 	for (i = 1; i <= maxtid; i++) {
@@ -860,6 +861,9 @@ loop:
 		res->total++;
 	}
 
+	close(fs.fd);
+	close(fs.jfd);
+
 	return 0;
 
 }