diff options
author | MÃ¥rten Kongstad <marten.kongstad@sony.com> | 2018-11-29 09:53:17 +0100 |
---|---|---|
committer | Todd Kennedy <toddke@google.com> | 2018-12-20 15:29:06 -0800 |
commit | b877902199770b5c6b70c796394fd5f6f45ac536 (patch) | |
tree | 1cc0b87369e9916f71776c8103b21d6841fc9e10 /cmds/idmap2/idmap2d/Idmap2Service.cpp | |
parent | fe88a7d7f2915c44107f35f3ce5a7917896ed075 (diff) |
idmap2: fix clang-tidy warnings [readability-*]
Bug: 120024673
Test: mmm frameworks/base/cmds/idmap2; check output
Change-Id: I1565afac8d34e4347d8c946228d1134211e8b435
Diffstat (limited to 'cmds/idmap2/idmap2d/Idmap2Service.cpp')
-rw-r--r-- | cmds/idmap2/idmap2d/Idmap2Service.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp index 86b00f1d6e95..7b16093434fb 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.cpp +++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp @@ -39,10 +39,11 @@ using android::binder::Status; using android::idmap2::BinaryStreamVisitor; using android::idmap2::Idmap; using android::idmap2::IdmapHeader; +using android::idmap2::utils::kIdmapFilePermissionMask; namespace { -static constexpr const char* kIdmapCacheDir = "/data/resource-cache"; +constexpr const char* kIdmapCacheDir = "/data/resource-cache"; Status ok() { return Status::ok(); @@ -69,13 +70,12 @@ Status Idmap2Service::removeIdmap(const std::string& overlay_apk_path, int32_t user_id ATTRIBUTE_UNUSED, bool* _aidl_return) { assert(_aidl_return); const std::string idmap_path = Idmap::CanonicalIdmapPathFor(kIdmapCacheDir, overlay_apk_path); - if (unlink(idmap_path.c_str()) == 0) { - *_aidl_return = true; - return ok(); - } else { + if (unlink(idmap_path.c_str()) != 0) { *_aidl_return = false; return error("failed to unlink " + idmap_path + ": " + strerror(errno)); } + *_aidl_return = true; + return ok(); } Status Idmap2Service::verifyIdmap(const std::string& overlay_apk_path, @@ -119,7 +119,7 @@ Status Idmap2Service::createIdmap(const std::string& target_apk_path, return error(err.str()); } - umask(0133); // u=rw,g=r,o=r + umask(kIdmapFilePermissionMask); const std::string idmap_path = Idmap::CanonicalIdmapPathFor(kIdmapCacheDir, overlay_apk_path); std::ofstream fout(idmap_path); if (fout.fail()) { |