From 243887b1e152ad5d895fd7e0f73f4478d0f38319 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 12 Apr 2019 16:40:21 -0700 Subject: [PATCH] Handle empty strings in GetPartitionAbsolutePath. Bug: N/A Test: liblp_test gtests Change-Id: I2440da17aa842d996a37d27b4bfba89ce71321d8 --- fs_mgr/liblp/partition_opener.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs_mgr/liblp/partition_opener.cpp b/fs_mgr/liblp/partition_opener.cpp index bb8ec9cb8..3b12213c3 100644 --- a/fs_mgr/liblp/partition_opener.cpp +++ b/fs_mgr/liblp/partition_opener.cpp @@ -26,6 +26,7 @@ #include #include +#include #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;