summaryrefslogtreecommitdiffstats
path: root/run-as/run-as.c
diff options
context:
space:
mode:
Diffstat (limited to 'run-as/run-as.c')
-rw-r--r--run-as/run-as.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/run-as/run-as.c b/run-as/run-as.c
index 20e1530..9eb09ae 100644
--- a/run-as/run-as.c
+++ b/run-as/run-as.c
@@ -29,6 +29,7 @@
#include <time.h>
#include <stdarg.h>
+#include <selinux/android.h>
#include <private/android_filesystem_config.h>
#include "package.h"
@@ -162,6 +163,11 @@ int main(int argc, char **argv)
return 1;
}
+ if (selinux_android_setcontext(uid, 0, NULL, pkgname) < 0) {
+ panic("Could not set SELinux security context: %s\n", strerror(errno));
+ return 1;
+ }
+
/* User specified command for exec. */
if (argc >= 3 ) {
if (execvp(argv[2], argv+2) < 0) {