summaryrefslogtreecommitdiff
path: root/cmds/installd/commands.c
diff options
context:
space:
mode:
author Fyodor Kupolov <fkupolov@google.com> 2015-04-07 20:18:23 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-04-07 20:18:23 +0000
commit4914f85f8073073194da5a88c557220456777eda (patch)
treefbc5d05c263ae53262b097e5ee52fb0fb59e8d0b /cmds/installd/commands.c
parent46072d5834aaef51922667972f02241a220333b8 (diff)
parent8f43f77de89df935e7dc2fdeddee132580bb5705 (diff)
am 8f43f77d: Merge "Use AID_SYSTEM as uid when creating oat dir"
* commit '8f43f77de89df935e7dc2fdeddee132580bb5705': Use AID_SYSTEM as uid when creating oat dir
Diffstat (limited to 'cmds/installd/commands.c')
-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 48bccc3da2..58e7efee92 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;