summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ryan Mitchell <rtmitchell@google.com> 2019-06-03 23:01:34 -0700
committer Ryan Mitchell <rtmitchell@google.com> 2019-06-04 06:05:31 +0000
commit7f08644bd7acc27d896bf7380d26e89ab7dfd381 (patch)
tree480a00deb22602d70109f70de4764b6abe39db44
parent56db15b8437e2e3bda63e19c30a87c56fa1dfde6 (diff)
Fix atoi build errors
Use strtol instead of atoi to check vendor partition version. Bug: 119390857 Test: manual Change-Id: I49c5963d8bbc5a803b3ccc0dd41d7bd7f2a42226
-rw-r--r--cmds/idmap2/idmap2/Scan.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp
index 21c6bd280064..cfac5f31e2e6 100644
--- a/cmds/idmap2/idmap2/Scan.cpp
+++ b/cmds/idmap2/idmap2/Scan.cpp
@@ -69,7 +69,10 @@ struct InputOverlay {
bool VendorIsQOrLater() {
constexpr int kQSdkVersion = 29;
- int version = std::atoi(android::base::GetProperty("ro.vndk.version", "29").data());
+ constexpr int kBase = 10;
+ std::string version_prop = android::base::GetProperty("ro.vndk.version", "29");
+ int version = strtol(version_prop.data(), nullptr, kBase);
+
// If the string cannot be parsed, it is a development sdk codename.
return version >= kQSdkVersion || version == 0;
}