OSDN Git Service

Merge commit '635193ab36302e5f65e99c7df2f256cfd37068c7' into am-b7f1a67b-2024-4274...
authorJeff Sharkey <jsharkey@android.com>
Fri, 1 Jun 2018 22:03:06 +0000 (16:03 -0600)
committerRyan Longair <rlongair@google.com>
Tue, 12 Jun 2018 18:27:10 +0000 (11:27 -0700)
* commit '635193ab36302e5f65e99c7df2f256cfd37068c7':
  Require quotes when searching for blkid keys.

Bug: 80436257
Test: manual
Change-Id: I4cbae2d594edefa10e5e2c5236d17fe3d37818cd
(cherry picked from commit 9a35ab6a4f0cbc47ff389f0c632218a39bf49a45)

Utils.cpp

index b6c7bf8..894de34 100644 (file)
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -213,17 +213,17 @@ static status_t readMetadata(const std::string& path, std::string& fsType,
     for (const auto& line : output) {
         // Extract values from blkid output, if defined
         const char* cline = line.c_str();
-        const char* start = strstr(cline, "TYPE=");
+        const char* start = strstr(cline, "TYPE=\"");
         if (start != nullptr && sscanf(start + 5, "\"%127[^\"]\"", value) == 1) {
             fsType = value;
         }
 
-        start = strstr(cline, "UUID=");
+        start = strstr(cline, "UUID=\"");
         if (start != nullptr && sscanf(start + 5, "\"%127[^\"]\"", value) == 1) {
             fsUuid = value;
         }
 
-        start = strstr(cline, "LABEL=");
+        start = strstr(cline, "LABEL=\"");
         if (start != nullptr && sscanf(start + 6, "\"%127[^\"]\"", value) == 1) {
             fsLabel = value;
         }