summaryrefslogtreecommitdiffstats
path: root/cmds/installd/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/installd/commands.c')
-rw-r--r--cmds/installd/commands.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 387f33d..2a54710 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -17,10 +17,7 @@
#include <linux/capability.h>
#include "installd.h"
#include <diskusage/dirsize.h>
-
-#ifdef HAVE_SELINUX
#include <selinux/android.h>
-#endif
/* Directory records that are used in execution of commands. */
dir_rec_t android_data_dir;
@@ -94,14 +91,12 @@ int install(const char *pkgname, uid_t uid, gid_t gid)
return -1;
}
-#ifdef HAVE_SELINUX
if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) {
ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
unlink(pkgdir);
- return -1;
+ return -errno;
}
-#endif
if (chown(pkgdir, uid, gid) < 0) {
ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
@@ -250,21 +245,19 @@ int make_user_data(const char *pkgname, uid_t uid, uid_t persona)
return -1;
}
- if (chown(pkgdir, uid, uid) < 0) {
- ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
+ if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) {
+ ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
unlink(pkgdir);
return -errno;
}
-#ifdef HAVE_SELINUX
- if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) {
- ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
+ if (chown(pkgdir, uid, uid) < 0) {
+ ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
unlink(pkgdir);
return -errno;
}
-#endif
return 0;
}