summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fat.c b/fat.c
index 7d07749..9253dce 100644
--- a/fat.c
+++ b/fat.c
@@ -910,7 +910,7 @@ checklost(int dosfs, struct bootblock *boot)
{
int mod = FSOK;
int ret;
- struct cluster_chain_descriptor *fat ;
+ struct cluster_chain_descriptor *fat, *next;
fat = RB_MIN(FSCK_MSDOS_CACHE,&rb_root);
if(!fat){
fsck_info("%s:rb_root tree is empty\n",__func__);
@@ -931,14 +931,18 @@ checklost(int dosfs, struct bootblock *boot)
/* If the reconnect failed, then just clear the chain */
pwarn("Error reconnecting chain - clearing\n");
mod &= ~FSFATAL;
+ next = RB_NEXT(FSCK_MSDOS_CACHE,0,fat);
clearchain(boot,fat,fat->head);
mod |= FSFATMOD;
- fat = RB_NEXT(FSCK_MSDOS_CACHE,0,fat);
+ fat = next;
continue;
}
if (ret == FSERROR && ask(1, "Clear")) {
+ next = RB_NEXT(FSCK_MSDOS_CACHE,0,fat);
clearchain(boot, fat, fat->head);
mod |= FSFATMOD;
+ fat = next;
+ continue;
}
fat = RB_NEXT(FSCK_MSDOS_CACHE,0,fat);
}