Ignore EEXIST errors when creating pkg specific dirs.
Some of the pkg specific dirs could be created by zygote and vold in parallel, so ignore any EEXIST errors while creating these dirs. Bug: 118185801 Test: manual Change-Id: Ifaa9998131764304867ac027af335414dbfc291c
This commit is contained in:
parent
bb517accbf
commit
6d285cec24
2 changed files with 6 additions and 4 deletions
|
@ -235,7 +235,7 @@ status_t CreateDir(const std::string& dir, mode_t mode) {
|
|||
PLOG(ERROR) << "Failed to stat " << dir;
|
||||
return -errno;
|
||||
}
|
||||
if (TEMP_FAILURE_RETRY(mkdir(dir.c_str(), mode)) == -1) {
|
||||
if (TEMP_FAILURE_RETRY(mkdir(dir.c_str(), mode)) == -1 && errno != EEXIST) {
|
||||
PLOG(ERROR) << "Failed to mkdir " << dir;
|
||||
return -errno;
|
||||
}
|
||||
|
|
|
@ -680,7 +680,7 @@ int VolumeManager::prepareSandboxTargets(userid_t userId,
|
|||
} else if (errno != ENOENT) {
|
||||
PLOG(ERROR) << "Failed to faccessat " << mntTargetRoot << "/" << package;
|
||||
}
|
||||
if (TEMP_FAILURE_RETRY(mkdirat(dfd.get(), package.c_str(), 0755)) == -1) {
|
||||
if (TEMP_FAILURE_RETRY(mkdirat(dfd.get(), package.c_str(), 0755)) == -1 && errno != EEXIST) {
|
||||
PLOG(ERROR) << "Failed to mkdirat " << mntTargetRoot << "/" << package;
|
||||
return -errno;
|
||||
}
|
||||
|
@ -718,7 +718,8 @@ int VolumeManager::prepareSandboxTargets(userid_t userId,
|
|||
} else if (errno != ENOENT) {
|
||||
PLOG(ERROR) << "Failed to faccessat " << pkgMountTarget << "/" << volumeLabel;
|
||||
}
|
||||
if (TEMP_FAILURE_RETRY(mkdirat(packageFd.get(), volumeLabel.c_str(), 0755)) == -1) {
|
||||
if (TEMP_FAILURE_RETRY(mkdirat(packageFd.get(), volumeLabel.c_str(), 0755)) == -1 &&
|
||||
errno != EEXIST) {
|
||||
PLOG(ERROR) << "Failed to mkdirat " << pkgMountTarget << "/" << volumeLabel;
|
||||
return -errno;
|
||||
}
|
||||
|
@ -742,7 +743,8 @@ int VolumeManager::prepareSandboxTargets(userid_t userId,
|
|||
}
|
||||
if (TEMP_FAILURE_RETRY(faccessat(packageFd.get(), "self", F_OK, 0)) == -1) {
|
||||
if (errno == ENOENT) {
|
||||
if (TEMP_FAILURE_RETRY(mkdirat(packageFd.get(), "self", 0755)) == -1) {
|
||||
if (TEMP_FAILURE_RETRY(mkdirat(packageFd.get(), "self", 0755)) == -1 &&
|
||||
errno != EEXIST) {
|
||||
PLOG(ERROR) << "Failed to mkdirat " << pkgMountTarget << "/self";
|
||||
return -errno;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue