summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorFyodor Kupolov <fkupolov@google.com>2015-04-06 19:09:02 -0700
committerFyodor Kupolov <fkupolov@google.com>2015-04-07 11:22:00 -0700
commit8eed7e6a9bb527af7380ec13b390c6e2955eba6a (patch)
treeb9ca8ee26daae62938fd2fad15ce52ac07480caf /cmds
parenta60ff367a4f55ea319625cf500687c5025604f40 (diff)
downloadframeworks_native-8eed7e6a9bb527af7380ec13b390c6e2955eba6a.zip
frameworks_native-8eed7e6a9bb527af7380ec13b390c6e2955eba6a.tar.gz
frameworks_native-8eed7e6a9bb527af7380ec13b390c6e2955eba6a.tar.bz2
Use AID_SYSTEM as uid when creating oat dir
Previously AID_INSTALL was used, which was causing permission denied errors when PackageManager was trying to recursively rename staging directory Bug: 19550105 Bug: 20087446 Change-Id: I3a9e3056c1fbc1ce0077a3ce52cf77ea6b5085ee
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 48bccc3..58e7efe 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -1711,12 +1711,7 @@ int create_oat_dir(const char* oat_dir, const char* instruction_set)
ALOGE("invalid apk path '%s' (bad prefix)\n", oat_dir);
return -1;
}
- if ((mkdir(oat_dir, S_IRWXU|S_IRWXG|S_IXOTH) < 0) && (errno != EEXIST)) {
- ALOGE("cannot create dir '%s': %s\n", oat_dir, strerror(errno));
- return -1;
- }
- if (chmod(oat_dir, S_IRWXU|S_IRWXG|S_IXOTH) < 0) {
- ALOGE("cannot chmod dir '%s': %s\n", oat_dir, strerror(errno));
+ if (fs_prepare_dir(oat_dir, S_IRWXU | S_IRWXG | S_IXOTH, AID_SYSTEM, AID_INSTALL)) {
return -1;
}
if (selinux_android_restorecon(oat_dir, 0)) {
@@ -1724,12 +1719,7 @@ int create_oat_dir(const char* oat_dir, const char* instruction_set)
return -1;
}
snprintf(oat_instr_dir, PKG_PATH_MAX, "%s/%s", oat_dir, instruction_set);
- if ((mkdir(oat_instr_dir, S_IRWXU|S_IRWXG|S_IXOTH) < 0) && (errno != EEXIST)) {
- ALOGE("cannot create dir '%s': %s\n", oat_instr_dir, strerror(errno));
- return -1;
- }
- if (chmod(oat_instr_dir, S_IRWXU|S_IRWXG|S_IXOTH) < 0) {
- ALOGE("cannot chmod dir '%s': %s\n", oat_dir, strerror(errno));
+ if (fs_prepare_dir(oat_instr_dir, S_IRWXU | S_IRWXG | S_IXOTH, AID_SYSTEM, AID_INSTALL)) {
return -1;
}
return 0;