summaryrefslogtreecommitdiff
path: root/check.c
diff options
context:
space:
mode:
Diffstat (limited to 'check.c')
-rw-r--r--check.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/check.c b/check.c
index f6a95a0..e4a8dfa 100644
--- a/check.c
+++ b/check.c
@@ -112,6 +112,7 @@ checkfilesys(const char *fname)
mod |= readfat(dosfs, &boot, boot.ValidFat >= 0 ? boot.ValidFat : 0, &fat);
if (mod & FSFATAL) {
+ printf("Fatal error during readfat()\n");
close(dosfs);
return 8;
}
@@ -122,21 +123,27 @@ checkfilesys(const char *fname)
mod |= readfat(dosfs, &boot, i, &currentFat);
- if (mod & FSFATAL)
+ if (mod & FSFATAL) {
+ printf("Fatal error during readfat() for comparison\n");
goto out;
+ }
mod |= comparefat(&boot, fat, currentFat, i);
free(currentFat);
- if (mod & FSFATAL)
+ if (mod & FSFATAL) {
+ printf("Fatal error during FAT comparison\n");
goto out;
+ }
}
if (!quiet)
printf("** Phase 2 - Check Cluster Chains\n");
mod |= checkfat(&boot, fat);
- if (mod & FSFATAL)
+ if (mod & FSFATAL) {
+ printf("Fatal error during FAT check\n");
goto out;
+ }
/* delay writing FATs */
if (!quiet)
@@ -144,8 +151,10 @@ checkfilesys(const char *fname)
mod |= resetDosDirSection(&boot, fat);
finish_dosdirsection = 1;
- if (mod & FSFATAL)
+ if (mod & FSFATAL) {
+ printf("Fatal error during resetDosDirSection()\n");
goto out;
+ }
/* delay writing FATs */
mod |= handleDirTree(dosfs, &boot, fat);
@@ -163,8 +172,10 @@ checkfilesys(const char *fname)
if (mod & FSFATMOD) {
if (ask(1, "Update FATs")) {
mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT);
- if (mod & FSFATAL)
+ if (mod & FSFATAL) {
+ printf("Fatal error during writefat()\n");
goto out;
+ }
} else
mod |= FSERROR;
}
@@ -205,8 +216,10 @@ checkfilesys(const char *fname)
free(fat);
close(dosfs);
- if (mod & (FSFATMOD|FSDIRMOD))
+ if (mod & (FSFATMOD|FSDIRMOD)) {
pwarn("\n***** FILE SYSTEM WAS MODIFIED *****\n");
+ return 4;
+ }
return ret;
}