From ecd9b0d8db69ef9d83fa1b14cab7692f56a7d35c Mon Sep 17 00:00:00 2001 From: lijiazi Date: Mon, 1 Jun 2020 18:51:13 +0800 Subject: [PATCH] liblp: fix host lpdump cannot work issue If a relative path is provided on linux host, lpdump will not work because GetPartitionAbsolutePath return an incorrect pathname. Test: lpdump super.img Change-Id: I7d0f10110eb72745edba810bdf288e2506bfedd6 Signed-off-by: lijiazi --- fs_mgr/liblp/partition_opener.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs_mgr/liblp/partition_opener.cpp b/fs_mgr/liblp/partition_opener.cpp index 1d4db8525..d5f9f4e07 100644 --- a/fs_mgr/liblp/partition_opener.cpp +++ b/fs_mgr/liblp/partition_opener.cpp @@ -38,6 +38,9 @@ using android::base::unique_fd; namespace { std::string GetPartitionAbsolutePath(const std::string& path) { +#if !defined(__ANDROID__) + return path; +#else if (android::base::StartsWith(path, "/")) { return path; } @@ -56,6 +59,7 @@ std::string GetPartitionAbsolutePath(const std::string& path) { } } return by_name; +#endif } bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device_info) {