From cb22040c6303144a42a90f424f29a267e43bef74 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 23 Sep 2016 15:30:55 -0700 Subject: Switch to . Bug: http://b/23102347 Test: boot into recovery. Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e --- uncrypt/bootloader_message_writer.cpp | 11 +++++------ uncrypt/uncrypt.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'uncrypt') diff --git a/uncrypt/bootloader_message_writer.cpp b/uncrypt/bootloader_message_writer.cpp index 3bb106aa0..db52121eb 100644 --- a/uncrypt/bootloader_message_writer.cpp +++ b/uncrypt/bootloader_message_writer.cpp @@ -17,12 +17,12 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -30,14 +30,13 @@ #include "bootloader.h" static struct fstab* read_fstab(std::string* err) { - // The fstab path is always "/fstab.${ro.hardware}". - std::string fstab_path = "/fstab."; - char value[PROP_VALUE_MAX]; - if (__system_property_get("ro.hardware", value) == 0) { + std::string ro_hardware = android::base::GetProperty("ro.hardware", ""); + if (ro_hardware.empty()) { *err = "failed to get ro.hardware"; return nullptr; } - fstab_path += value; + // The fstab path is always "/fstab.${ro.hardware}". + std::string fstab_path = "/fstab." + ro_hardware; struct fstab* fstab = fs_mgr_read_fstab(fstab_path.c_str()); if (fstab == nullptr) { *err = "failed to read " + fstab_path; diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp index 96edfd781..dea8445ea 100644 --- a/uncrypt/uncrypt.cpp +++ b/uncrypt/uncrypt.cpp @@ -107,12 +107,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include @@ -163,13 +163,15 @@ static struct fstab* read_fstab() { fstab = NULL; // The fstab path is always "/fstab.${ro.hardware}". - char fstab_path[PATH_MAX+1] = "/fstab."; - if (!property_get("ro.hardware", fstab_path+strlen(fstab_path), "")) { + std::string ro_hardware = android::base::GetProperty("ro.hardware", ""); + if (ro_hardware.empty()) { LOG(ERROR) << "failed to get ro.hardware"; return NULL; } - fstab = fs_mgr_read_fstab(fstab_path); + std::string fstab_path = "/fstab." + ro_hardware; + + fstab = fs_mgr_read_fstab(fstab_path.c_str()); if (!fstab) { LOG(ERROR) << "failed to read " << fstab_path; return NULL; @@ -194,9 +196,7 @@ static const char* find_block_device(const char* path, bool* encryptable, bool* *encryptable = false; if (fs_mgr_is_encryptable(v) || fs_mgr_is_file_encrypted(v)) { *encryptable = true; - char buffer[PROPERTY_VALUE_MAX+1]; - if (property_get("ro.crypto.state", buffer, "") && - strcmp(buffer, "encrypted") == 0) { + if (android::base::GetProperty("ro.crypto.state", "") == "encrypted") { *encrypted = true; } } -- cgit v1.2.3