diff options
author | Nikita Ioffe <ioffe@google.com> | 2019-06-21 01:21:13 +0100 |
---|---|---|
committer | Nikita Ioffe <ioffe@google.com> | 2019-06-25 09:44:48 +0100 |
commit | 8a8a356efa93acf20f88dffae7da211aba276513 (patch) | |
tree | 3d94fbeea5361b5c986831704d1ea6ef3a600bc2 | |
parent | 996e39f0a40b99a6acd4083a798bae6ef152bc3b (diff) | |
download | platform_system_apex-8a8a356efa93acf20f88dffae7da211aba276513.tar.gz platform_system_apex-8a8a356efa93acf20f88dffae7da211aba276513.tar.bz2 platform_system_apex-8a8a356efa93acf20f88dffae7da211aba276513.zip |
Add missing return statement in ApexFile.verifyDescriptor
Fixed other places in apexd that didn't use resulting Status/StatusOr.
Didn't mark Status and StatusOr as WARN_UNUSED as it will require
changing code outside of apexd. Instead fixed them in AOSP.
Test: m apexd
Bug: 135682248
Fixes: 135682248
Change-Id: I3e362b3284bcdcc7e6d68e4691dc4f042f3af1da
Merged-In: I3e362b3284bcdcc7e6d68e4691dc4f042f3af1da
-rw-r--r-- | apexd/apex_database.cpp | 5 | ||||
-rw-r--r-- | apexd/apex_file.cpp | 2 | ||||
-rw-r--r-- | apexd/apexd.cpp | 19 |
3 files changed, 21 insertions, 5 deletions
diff --git a/apexd/apex_database.cpp b/apexd/apex_database.cpp index 53793659..0a8f1377 100644 --- a/apexd/apex_database.cpp +++ b/apexd/apex_database.cpp @@ -152,7 +152,7 @@ inode_map scanFlattendedPackages() { inode_map map; for (const auto& dir : kApexPackageBuiltinDirs) { - WalkDir(dir, [&](const fs::directory_entry& entry) { + auto status = WalkDir(dir, [&](const fs::directory_entry& entry) { const auto& path = entry.path(); if (isFlattenedApex(path)) { auto inode = inodeFor(path); @@ -161,6 +161,9 @@ inode_map scanFlattendedPackages() { } } }); + if (!status.Ok()) { + LOG(ERROR) << "Failed to walk " << dir << " : " << status.ErrorMessage(); + } } return map; diff --git a/apexd/apex_file.cpp b/apexd/apex_file.cpp index 80e60522..9f630ddb 100644 --- a/apexd/apex_file.cpp +++ b/apexd/apex_file.cpp @@ -391,7 +391,7 @@ StatusOr<std::unique_ptr<AvbHashtreeDescriptor>> verifyDescriptor( if (!avb_hashtree_descriptor_validate_and_byteswap(desc, verifiedDesc.get())) { - StatusOr<std::unique_ptr<AvbHashtreeDescriptor>>::MakeError( + return StatusOr<std::unique_ptr<AvbHashtreeDescriptor>>::MakeError( "Couldn't validate AvbDescriptor."); } diff --git a/apexd/apexd.cpp b/apexd/apexd.cpp index 355934d6..4f5ca521 100644 --- a/apexd/apexd.cpp +++ b/apexd/apexd.cpp @@ -1381,7 +1381,11 @@ void scanStagedSessionsDirAndStage() { auto session_failed_fn = [&]() { LOG(WARNING) << "Marking session " << sessionId << " as failed."; - session.UpdateStateAndCommit(SessionState::ACTIVATION_FAILED); + auto st = session.UpdateStateAndCommit(SessionState::ACTIVATION_FAILED); + if (!st.Ok()) { + LOG(WARNING) << "Failed to mark session " << sessionId + << " as failed : " << st.ErrorMessage(); + } }; auto scope_guard = android::base::make_scope_guard(session_failed_fn); @@ -1446,7 +1450,11 @@ void scanStagedSessionsDirAndStage() { // Session was OK, release scopeguard. scope_guard.Disable(); - session.UpdateStateAndCommit(SessionState::ACTIVATED); + auto st = session.UpdateStateAndCommit(SessionState::ACTIVATED); + if (!st.Ok()) { + LOG(ERROR) << "Failed to mark " << session + << " as activated : " << st.ErrorMessage(); + } } } @@ -1668,7 +1676,12 @@ int onBootstrap() { } // Activate built-in APEXes for processes launched before /data is mounted. - scanPackagesDirAndActivate(kApexPackageSystemDir); + status = scanPackagesDirAndActivate(kApexPackageSystemDir); + if (!status.Ok()) { + LOG(ERROR) << "Failed to activate APEX files in " << kApexPackageSystemDir + << " : " << status.ErrorMessage(); + return 1; + } LOG(INFO) << "Bootstrapping done"; return 0; } |