mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[cmp] propagate decompression errors from bled
If, for example, you have a truncated gz-compressed file and try to write it to disk, bled_uncompress_with_handles() will return an error. Previously, this was not reported back to the user -- there's no indication of any problem. If they're lucky, booting the partially-written disk will fail in an obvious way, but better to report an error sooner, even if we cannot give details.
This commit is contained in:
parent
7f82dbf0fc
commit
b95e87040b
1 changed files with 8 additions and 1 deletions
|
@ -1541,10 +1541,17 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
|
|||
LastRefresh = 0;
|
||||
|
||||
if (img_report.compression_type != BLED_COMPRESSION_NONE) {
|
||||
int64_t bled_ret;
|
||||
uprintf("Writing Compressed Image...");
|
||||
bled_init(_uprintf, update_progress, &FormatStatus);
|
||||
bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type);
|
||||
bled_ret = bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type);
|
||||
bled_exit();
|
||||
if (bled_ret < 0 && SCODE_CODE(FormatStatus) != ERROR_CANCELLED) {
|
||||
// Unfortunately, different compression backends return different negative error codes
|
||||
uprintf("Writing compressed image failed: %" PRIi64, bled_ret);
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_WRITE_FAULT;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
uprintf(hSourceImage?"Writing Image...":"Zeroing drive...");
|
||||
// Our buffer size must be a multiple of the sector size and *ALIGNED* to the sector size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue