From a7fd7b168905bca489a9ff43a507293de7b067ce Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Jun 2022 18:18:49 -0700 Subject: [PATCH] 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 --- libsparse/sparse_read.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {