summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-02-23 23:40:17 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-23 23:40:17 +0000
commit2abdd94724f05baf9f5dd737df85454b76db221b (patch)
treeb3d7d5886ca1e332e85438e54febb7e9c02aa72c
parent164d97f3f26173571f8025ca680e753630788a3d (diff)
parent5c3e9480060a8bfb9ee3e5e48fadbcd50778922a (diff)
downloadgsid-2abdd94724f05baf9f5dd737df85454b76db221b.tar.gz
Merge "Move external storage mkdir to ValidateInstallParams" am: 41ec4141a5 am: 5c3e948006
Original change: https://android-review.googlesource.com/c/platform/system/gsid/+/1596273 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ie725f6c05a4369751e4b72c87ea6871e5a3ddd87
-rw-r--r--gsi_service.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp
index e4052b2..002c51f 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -130,15 +130,6 @@ binder::Status GsiService::openInstall(const std::string& install_dir, int* _aid
*_aidl_return = status;
return binder::Status::ok();
}
- if (access(install_dir_.c_str(), F_OK) != 0 && errno == ENOENT) {
- if (IsExternalStoragePath(install_dir_)) {
- if (mkdir(install_dir_.c_str(), 0755) != 0) {
- PLOG(ERROR) << "Failed to create " << install_dir_;
- *_aidl_return = IGsiService::INSTALL_ERROR_GENERIC;
- return binder::Status::ok();
- }
- }
- }
std::string message;
auto dsu_slot = GetDsuSlot(install_dir_);
if (!RemoveFileIfExists(GetCompleteIndication(dsu_slot), &message)) {
@@ -845,6 +836,14 @@ int GsiService::ValidateInstallParams(std::string& install_dir) {
install_dir = kDefaultDsuImageFolder;
}
+ if (access(install_dir.c_str(), F_OK) != 0 && (errno == ENOENT)) {
+ if (android::base::StartsWith(install_dir, kDsuSDPrefix)) {
+ if (mkdir(install_dir.c_str(), 0755) != 0) {
+ PLOG(ERROR) << "Failed to create " << install_dir;
+ return INSTALL_ERROR_GENERIC;
+ }
+ }
+ }
// Normalize the path and add a trailing slash.
std::string origInstallDir = install_dir;
if (!android::base::Realpath(origInstallDir, &install_dir)) {