adb_root: Simplify the way we parse enabled state file
On a failed conversion, instead of throwing a C++ exception (and we have
exceptions disabled, so we get abort()ed instead), we just say it's
disabled, which is better than crashing.
Change-Id: Ia3e5432b2591b98f8cb5911b39459260b9ac6ba6
diff --git a/root/adbroot_service.cpp b/root/adbroot_service.cpp
index d622fdd..710a521 100644
--- a/root/adbroot_service.cpp
+++ b/root/adbroot_service.cpp
@@ -46,7 +46,7 @@
ADBRootService::ADBRootService() : enabled_(false) {
std::string buf;
if (ReadFileToString(kStoragePath + kEnabled, &buf)) {
- enabled_ = std::stoi(Trim(buf));
+ enabled_ = Trim(buf) == "1";
}
}