Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/plugins/fs/exfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ gboolean bd_fs_exfat_check (const gchar *device, const BDExtraArg **extra, GErro
return FALSE;

ret = bd_utils_exec_and_report_status_error (args, extra, &status, error);
if (!ret && (status == 1)) {
/* no error should be reported for exit code 1 */
if (!ret && (status == 1 || status == 4)) {
/* no error should be reported for exit code 1 and exit code 4 - File system errors left uncorrected */
g_clear_error (error);
}
return ret;
Expand Down
21 changes: 21 additions & 0 deletions tests/fs_tests/exfat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,27 @@ def test_exfat_check(self):
succ = BlockDev.fs_exfat_check(self.loop_devs[0])
self.assertTrue(succ)

def test_exfat_check_corrupted(self):
"""Verify that checking a corrupted exfat file system reports it as not clean"""

succ = BlockDev.fs_exfat_mkfs(self.loop_devs[0], self._mkfs_options)
self.assertTrue(succ)

# zero the checksum sector of the main boot region
with open(self.loop_devs[0], "r+b") as dev:
sector_size = 2 ** dev.read(512)[108]
dev.seek(11 * sector_size)
dev.write(b"\0" * sector_size)

succ = BlockDev.fs_exfat_check(self.loop_devs[0])
self.assertFalse(succ)

succ = BlockDev.fs_exfat_repair(self.loop_devs[0])
self.assertTrue(succ)

succ = BlockDev.fs_exfat_check(self.loop_devs[0])
self.assertTrue(succ)


class ExfatTestRepair(ExfatTestCase):
def test_exfat_repair(self):
Expand Down
Loading