diff options
author | relan <relan@users.noreply.github.com> | 2015-07-11 11:07:53 +0300 |
---|---|---|
committer | relan <relan@users.noreply.github.com> | 2015-08-24 08:36:19 +0300 |
commit | 8c4c5fabc4f571fbb3e2ae6429958be8a4d62807 (patch) | |
tree | be2f2adb0f27f0194d83aea28624bf5f93fde066 | |
parent | feaadd56fcf31d9aa5346005ff4558db996a42d2 (diff) | |
download | android_external_exfat-8c4c5fabc4f571fbb3e2ae6429958be8a4d62807.tar.gz android_external_exfat-8c4c5fabc4f571fbb3e2ae6429958be8a4d62807.tar.bz2 android_external_exfat-8c4c5fabc4f571fbb3e2ae6429958be8a4d62807.zip |
Recognize optional entries.
Memory cards formatted by Sony cameras have mysterious 0xe1 entries.
Looks like they can be safely ignored. So now if entry type is unknown
and has 0x20 flag set there will be a warning instead of error.
-rw-r--r-- | libexfat/exfatfs.h | 1 | ||||
-rw-r--r-- | libexfat/node.c | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libexfat/exfatfs.h b/libexfat/exfatfs.h index 7d8f8bf..87b47b5 100644 --- a/libexfat/exfatfs.h +++ b/libexfat/exfatfs.h @@ -69,6 +69,7 @@ STATIC_ASSERT(sizeof(struct exfat_super_block) == 512); #define EXFAT_ENTRY_VALID 0x80 #define EXFAT_ENTRY_CONTINUED 0x40 +#define EXFAT_ENTRY_OPTIONAL 0x20 #define EXFAT_ENTRY_BITMAP (0x01 | EXFAT_ENTRY_VALID) #define EXFAT_ENTRY_UPCASE (0x02 | EXFAT_ENTRY_VALID) diff --git a/libexfat/node.c b/libexfat/node.c index 912b4fc..6e18c09 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -454,11 +454,21 @@ static int readdir(struct exfat* ef, const struct exfat_node* parent, break; default: - if (entry->type & EXFAT_ENTRY_VALID) + if (!(entry->type & EXFAT_ENTRY_VALID)) + break; /* deleted entry, ignore it */ + if (!(entry->type & EXFAT_ENTRY_OPTIONAL)) { - exfat_error("unknown entry type 0x%hhx", entry->type); + exfat_error("unknown entry type %#hhx", entry->type); goto error; } + /* optional entry, warn and skip */ + exfat_warn("unknown entry type %#hhx", entry->type); + if (continuations == 0) + { + exfat_error("unexpected continuation"); + goto error; + } + --continuations; break; } |