diff options
-rw-r--r-- | cmds/installd/commands.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index 9d0dc53..0d0a6f0 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -73,13 +73,20 @@ int install(const char *pkgname, uid_t uid, gid_t gid) return -errno; } - if (selinux_android_setfilecon(libdir, pkgname, uid) < 0) { + if (selinux_android_setfilecon(libdir, pkgname, AID_SYSTEM) < 0) { ALOGE("cannot setfilecon dir '%s': %s\n", libdir, strerror(errno)); unlink(libdir); unlink(pkgdir); return -errno; } + if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) { + ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); + unlink(libdir); + unlink(pkgdir); + return -errno; + } + if (chown(pkgdir, uid, gid) < 0) { ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno)); unlink(libdir); |