Fix mistaken removal of setfilecon
Previous commit attempted to move setfilecon above chown, but mistakenly
squashed libdir and pkgdir setfilcon into one incorrect setfilecon.
Change-Id: I1ad00eae8a0e69ae88ce47cd5571558ce1ad2145
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 @@
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);