libsparse: Don't spam errors in sparse_file_import_auto.

This function is intended for use on sparse or non-sparse files. But
when used on non-sparse files, it unintentionally reports errors when
trying to detect if the file is sparse or not.

Since the behavior is the same whether or not the detection fails, this
patch disables verbose errors during the import. Verbose errors are
turned on if a resparse is needed.

Bug: 210846593
Test: fastboot flashall
Change-Id: I8404ca7a67adc7fba8a3ac7b4ffa18abfbcafa9d
This commit is contained in:
David Anderson 2022-06-01 18:18:49 -07:00
parent d17cefe7e4
commit a7fd7b1689

View file

@ -670,7 +670,7 @@ struct sparse_file* sparse_file_import_auto(int fd, bool crc, bool verbose) {
int64_t len;
int ret;
s = sparse_file_import(fd, verbose, crc);
s = sparse_file_import(fd, false, crc);
if (s) {
return s;
}
@ -686,6 +686,9 @@ struct sparse_file* sparse_file_import_auto(int fd, bool crc, bool verbose) {
if (!s) {
return nullptr;
}
if (verbose) {
sparse_file_verbose(s);
}
ret = sparse_file_read_normal(s, fd);
if (ret < 0) {