[ext2fs] return a more explicit error on directory corruption

This commit is contained in:
Pete Batard 2022-05-14 10:19:36 +02:00
parent 4cdbad283a
commit 1dcfd69dee
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 7 additions and 8 deletions

View file

@ -406,14 +406,14 @@ BOOL FormatExtFs(DWORD DriveIndex, uint64_t PartitionOffset, DWORD BlockSize, LP
// Create root and lost+found dirs
r = ext2fs_mkdir(ext2fs, EXT2_ROOT_INO, EXT2_ROOT_INO, 0);
if (r != 0) {
SET_EXT2_FORMAT_ERROR(ERROR_DIR_NOT_ROOT);
SET_EXT2_FORMAT_ERROR(ERROR_FILE_CORRUPT);
uprintf("Failed to create %s root dir: %s", FSName, error_message(r));
goto out;
}
ext2fs->umask = 077;
r = ext2fs_mkdir(ext2fs, EXT2_ROOT_INO, 0, "lost+found");
if (r != 0) {
SET_EXT2_FORMAT_ERROR(ERROR_DIR_NOT_ROOT);
SET_EXT2_FORMAT_ERROR(ERROR_FILE_CORRUPT);
uprintf("Failed to create %s 'lost+found' dir: %s", FSName, error_message(r));
goto out;
}
@ -491,7 +491,6 @@ BOOL FormatExtFs(DWORD DriveIndex, uint64_t PartitionOffset, DWORD BlockSize, LP
goto out;
}
UpdateProgressWithInfo(OP_FORMAT, MSG_217, 100, 100);
uprintf("Done");
ret = TRUE;
out: