am 2507aed4: reset to 016806a7, but keep bad history for fast forward
# By Rom Lemarchand (11) and others
# Via Android Git Automerger (194) and others
* commit '2507aed4300ffddfe0bd22843093ce66cf0a7b52': (48 commits)
cutils: remove dead code.
logwrap: add quiet flag to logwrap()
logwrap: Replace sigprocmask with pthread_sigmask
logwrap: wait for child process when receiving SIGINT or SIGQUIT
logwrap: ensure child exits with _exit
Delete frameworks/base/voip use voip-common from frameworks/opt/net/voip
logwrap: remove unnecessary call to setuid/setgid
logwrap: fix off by 1 argument error
logwrapper: switch to signal handlers for SIGCHLD
property_service: make /dev/__properties__ readable
toolbox: renice: Add -t TYPE parameter and switch to getopt
libsuspend: compile as a static library
Revert "init: make system properties more secure."
init: make system properties more secure.
Revert "init.usb.rc: set sys.usb.config to none before changing it"
adb: Add "unauthorized" connection state
adb: Read secure adb keys on every auth request
logwrapper: prevent logwrap from hanging when child dies
logwrapper: split into liblogwrap and the executable itself
cutils: add simple reference counter
...
diff --git a/init/init.c b/init/init.c
index 1c80d9c..fa2b4e8 100755
--- a/init/init.c
+++ b/init/init.c
@@ -206,28 +206,36 @@
#ifdef HAVE_SELINUX
if (is_selinux_enabled() > 0) {
- char *mycon = NULL, *fcon = NULL;
+ if (svc->seclabel) {
+ scon = strdup(svc->seclabel);
+ if (!scon) {
+ ERROR("Out of memory while starting '%s'\n", svc->name);
+ return;
+ }
+ } else {
+ char *mycon = NULL, *fcon = NULL;
- INFO("computing context for service '%s'\n", svc->args[0]);
- rc = getcon(&mycon);
- if (rc < 0) {
- ERROR("could not get context while starting '%s'\n", svc->name);
- return;
- }
+ INFO("computing context for service '%s'\n", svc->args[0]);
+ rc = getcon(&mycon);
+ if (rc < 0) {
+ ERROR("could not get context while starting '%s'\n", svc->name);
+ return;
+ }
- rc = getfilecon(svc->args[0], &fcon);
- if (rc < 0) {
- ERROR("could not get context while starting '%s'\n", svc->name);
+ rc = getfilecon(svc->args[0], &fcon);
+ if (rc < 0) {
+ ERROR("could not get context while starting '%s'\n", svc->name);
+ freecon(mycon);
+ return;
+ }
+
+ rc = security_compute_create(mycon, fcon, string_to_security_class("process"), &scon);
freecon(mycon);
- return;
- }
-
- rc = security_compute_create(mycon, fcon, string_to_security_class("process"), &scon);
- freecon(mycon);
- freecon(fcon);
- if (rc < 0) {
- ERROR("could not get context while starting '%s'\n", svc->name);
- return;
+ freecon(fcon);
+ if (rc < 0) {
+ ERROR("could not get context while starting '%s'\n", svc->name);
+ return;
+ }
}
}
#endif