Handle empty strings in GetPartitionAbsolutePath.

Bug: N/A
Test: liblp_test gtests
Change-Id: I2440da17aa842d996a37d27b4bfba89ce71321d8
This commit is contained in:
David Anderson 2019-04-12 16:40:21 -07:00
parent 8a9a1c5056
commit 243887b1e1

View file

@ -26,6 +26,7 @@
#include <unistd.h>
#include <android-base/file.h>
#include <android-base/strings.h>
#include "utility.h"
@ -37,7 +38,7 @@ using android::base::unique_fd;
namespace {
std::string GetPartitionAbsolutePath(const std::string& path) {
if (path[0] == '/') {
if (android::base::StartsWith(path, "/")) {
return path;
}
return "/dev/block/by-name/" + path;