X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fexfat-utils.git;a=blobdiff_plain;f=libexfat%2Fnode.c;h=ab1d7d6d04c7d36831c34c20dda7b0c5a4fade6e;hp=b544bd966d1cd7ff8f3733b89909e3cc588b0e68;hb=b389db553b85947429af3c455bb324da02429abd;hpb=3639f26edacd0198b1d3e4834000a88b6a43612c diff --git a/libexfat/node.c b/libexfat/node.c index b544bd9..ab1d7d6 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -3,7 +3,7 @@ exFAT file system implementation library. Free exFAT implementation. - Copyright (C) 2010-2017 Andrew Nayenko + Copyright (C) 2010-2018 Andrew Nayenko This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -223,7 +223,8 @@ static bool check_node(const struct exfat* ef, struct exfat_node* node, exfat_get_name(node, buffer); exfat_error("'%s' has invalid checksum (%#hx != %#hx)", buffer, le16_to_cpu(actual_checksum), le16_to_cpu(meta1->checksum)); - ret = false; + if (!EXFAT_REPAIR(invalid_node_checksum, ef, node)) + ret = false; } /* @@ -516,7 +517,8 @@ static int readdir(struct exfat* ef, struct exfat_node* parent, break; /* deleted entry, ignore it */ exfat_error("unknown entry type %#hhx", entry.type); - return -EIO; + if (!EXFAT_REPAIR(unknown_entry, ef, parent, &entry, *offset)) + return -EIO; } *offset += sizeof(entry); } @@ -855,7 +857,8 @@ static int find_slot(struct exfat* ef, struct exfat_node* dir, free(dmap); return -EIO; case -EINVAL: - /* slot is occupied, continue searching */ + /* slot at (i-n) is occupied, go back and check (i-n+1) */ + i -= contiguous - 1; contiguous = 0; break; }