summaryrefslogtreecommitdiff
path: root/libsparse
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2022-06-01 18:18:49 -0700
committerDavid Anderson <dvander@google.com>2022-06-01 18:36:04 -0700
commita7fd7b168905bca489a9ff43a507293de7b067ce (patch)
treed944e1a65aa549d94d16c0216aba1d8f7265931d /libsparse
parentd17cefe7e4f44bb4ec3e72bf2088e895ce83714d (diff)
downloadcore-a7fd7b168905bca489a9ff43a507293de7b067ce.tar.gz
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
Diffstat (limited to 'libsparse')
-rw-r--r--libsparse/sparse_read.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp
index 028b6bed1..44f75576d 100644
--- a/libsparse/sparse_read.cpp
+++ b/libsparse/sparse_read.cpp
@@ -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) {