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 <lijiazi@xiaomi.com>
This commit is contained in:
parent
51b127c71e
commit
ecd9b0d8db
|
@ -38,6 +38,9 @@ using android::base::unique_fd;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
std::string GetPartitionAbsolutePath(const std::string& path) {
|
std::string GetPartitionAbsolutePath(const std::string& path) {
|
||||||
|
#if !defined(__ANDROID__)
|
||||||
|
return path;
|
||||||
|
#else
|
||||||
if (android::base::StartsWith(path, "/")) {
|
if (android::base::StartsWith(path, "/")) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +59,7 @@ std::string GetPartitionAbsolutePath(const std::string& path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return by_name;
|
return by_name;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device_info) {
|
bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device_info) {
|
||||||
|
|
Loading…
Reference in New Issue