From 67212f9083cc032d72609218099e7b98db839f6c Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 2 Nov 2017 15:40:36 -0700 Subject: [PATCH] fastboot: Don't give parsing error for unsupported 'getvar erase-block-size'. Couldn't parse erase-block-size '0x'. Couldn't parse logical-block-size '0x'. mke2fs 1.43.3 (04-Sep-2016) ... Some bootloaders explicitly return error on failed query (e.g. walleye), while others return empty message (e.g. bullhead). We should just return zero for empty message, instead of giving a misleading parsing error. Test: `fastboot format userdata` on bullhead, with no parsing error. Test: `fastboot format userdata` on walleye still works. Change-Id: I194d41d24679929eccc65bfe895d6ab2a26315b7 --- fastboot/fastboot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index c3b1bfb2e..df755aabb 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -1354,7 +1354,7 @@ static std::string fb_fix_numeric_var(std::string var) { static unsigned fb_get_flash_block_size(Transport* transport, std::string name) { std::string sizeString; - if (!fb_getvar(transport, name.c_str(), &sizeString)) { + if (!fb_getvar(transport, name.c_str(), &sizeString) || sizeString.empty()) { /* This device does not report flash block sizes, so return 0 */ return 0; }