Create stash dir recursively.
When applying an OTA package onto the device in OTA mode, if the recovery logs haven't been viewed, there is a chance that /cache/recovery does not exist. Then, stash creation will fail. Create stash directories recursively to avoid this error. Test: without /cache/recovery, sideload the OTA on cuttlefish Change-Id: I5cc01a067d866476a3594e795dcb5b15649e817b
This commit is contained in:
parent
22a27f9965
commit
63f5260c6c
1 changed files with 2 additions and 1 deletions
|
@ -53,6 +53,7 @@
|
||||||
#include <ziparchive/zip_archive.h>
|
#include <ziparchive/zip_archive.h>
|
||||||
|
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
|
#include "otautil/dirutil.h"
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "otautil/paths.h"
|
#include "otautil/paths.h"
|
||||||
#include "otautil/print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
@ -878,7 +879,7 @@ static int CreateStash(State* state, size_t maxblocks, const std::string& base)
|
||||||
size_t max_stash_size = maxblocks * BLOCKSIZE;
|
size_t max_stash_size = maxblocks * BLOCKSIZE;
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
LOG(INFO) << "creating stash " << dirname;
|
LOG(INFO) << "creating stash " << dirname;
|
||||||
res = mkdir(dirname.c_str(), STASH_DIRECTORY_MODE);
|
res = mkdir_recursively(dirname, STASH_DIRECTORY_MODE, false, nullptr);
|
||||||
|
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
ErrorAbort(state, kStashCreationFailure, "mkdir \"%s\" failed: %s", dirname.c_str(),
|
ErrorAbort(state, kStashCreationFailure, "mkdir \"%s\" failed: %s", dirname.c_str(),
|
||||||
|
|
Loading…
Reference in a new issue