git » libjio » commit 58faf05

Add checks for operations inside jfsck_cleanup()

author Alberto Bertogli
2009-02-26 23:11:26 UTC
committer Alberto Bertogli
2009-03-02 00:41:21 UTC
parent 9b42486d89cc99e2d3ba042bf98a9884a75e7a8b

Add checks for operations inside jfsck_cleanup()

check.c +8 -3

diff --git a/check.c b/check.c
index 251d6a1..4fd82b2 100644
--- a/check.c
+++ b/check.c
@@ -356,11 +356,16 @@ int jfsck_cleanup(const char *name, const char *jdir)
 		}
 
 		/* and remove it */
-		unlink(tfile);
+		if (unlink(tfile) != 0) {
+			closedir(dir);
+			return 0;
+		}
 	}
-	closedir(dir);
+	if (closedir(dir) != 0)
+		return 0;
 
-	rmdir(path);
+	if (rmdir(path) != 0)
+		return 0;
 
 	return 1;
 }