diff options
author | Tianjie Xu <xunchang@google.com> | 2017-03-22 19:40:43 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-22 19:40:43 +0100 |
commit | b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8 (patch) | |
tree | a49512761ee50a3480aaad683ce9df930a22e2e7 /updater | |
parent | Merge "Refactor asn1_decoder functions into a class." am: ea3d0b923d am: d7846b7303 (diff) | |
parent | Merge "Fix the permission of stashed blocks created by updater" am: d882b8892a (diff) | |
download | android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.tar android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.tar.gz android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.tar.bz2 android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.tar.lz android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.tar.xz android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.tar.zst android_bootable_recovery-b39a90f0bc224eeb43972b4f7a3dd651ae70b6f8.zip |
Diffstat (limited to 'updater')
-rw-r--r-- | updater/blockimg.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp index 0fa83d9d5..8dbd8c7d1 100644 --- a/updater/blockimg.cpp +++ b/updater/blockimg.cpp @@ -44,6 +44,7 @@ #include <android-base/unique_fd.h> #include <applypatch/applypatch.h> #include <openssl/sha.h> +#include <private/android_filesystem_config.h> #include <ziparchive/zip_archive.h> #include "edify/expr.h" @@ -772,6 +773,11 @@ static int WriteStash(const std::string& base, const std::string& id, int blocks return -1; } + if (fchown(fd, AID_SYSTEM, AID_SYSTEM) != 0) { // system user + PLOG(ERROR) << "failed to chown \"" << fn << "\""; + return -1; + } + if (write_all(fd, buffer, blocks * BLOCKSIZE) == -1) { return -1; } @@ -841,6 +847,12 @@ static int CreateStash(State* state, size_t maxblocks, const std::string& blockd return -1; } + if (chown(dirname.c_str(), AID_SYSTEM, AID_SYSTEM) != 0) { // system user + ErrorAbort(state, kStashCreationFailure, "chown \"%s\" failed: %s\n", dirname.c_str(), + strerror(errno)); + return -1; + } + if (CacheSizeCheck(max_stash_size) != 0) { ErrorAbort(state, kStashCreationFailure, "not enough space for stash (%zu needed)\n", max_stash_size); |