diff options
Diffstat (limited to 'init/init.c')
-rw-r--r-- | init/init.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/init/init.c b/init/init.c index bd7799e..00f4558 100644 --- a/init/init.c +++ b/init/init.c @@ -221,6 +221,9 @@ void service_start(struct service *svc, const char *dynamic_args) } rc = security_compute_create(mycon, fcon, string_to_security_class("process"), &scon); + if (rc == 0 && !strcmp(scon, mycon)) { + ERROR("Warning! Service %s needs a SELinux domain defined; please fix!\n", svc->name); + } freecon(mycon); freecon(fcon); if (rc < 0) { @@ -250,14 +253,12 @@ void service_start(struct service *svc, const char *dynamic_args) for (ei = svc->envvars; ei; ei = ei->next) add_environment(ei->name, ei->value); - setsockcreatecon(scon); - for (si = svc->sockets; si; si = si->next) { int socket_type = ( !strcmp(si->type, "stream") ? SOCK_STREAM : (!strcmp(si->type, "dgram") ? SOCK_DGRAM : SOCK_SEQPACKET)); int s = create_socket(si->name, socket_type, - si->perm, si->uid, si->gid); + si->perm, si->uid, si->gid, si->socketcon ?: scon); if (s >= 0) { publish_socket(si->name, s); } @@ -265,7 +266,6 @@ void service_start(struct service *svc, const char *dynamic_args) freecon(scon); scon = NULL; - setsockcreatecon(NULL); if (svc->ioprio_class != IoSchedClass_NONE) { if (android_set_ioprio(getpid(), svc->ioprio_class, svc->ioprio_pri)) { @@ -623,7 +623,7 @@ static int mix_hwrng_into_linux_rng_action(int nargs, char **args) total_bytes_written += chunk_size; } - INFO("Mixed %d bytes from /dev/hw_random into /dev/urandom", + INFO("Mixed %zu bytes from /dev/hw_random into /dev/urandom", total_bytes_written); result = 0; @@ -657,29 +657,28 @@ static int console_init_action(int nargs, char **args) have_console = 1; close(fd); - if( load_565rle_image(INIT_IMAGE_FILE) ) { - fd = open("/dev/tty0", O_WRONLY); - if (fd >= 0) { - const char *msg; - msg = "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" // console is 40 cols x 30 lines - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - " A N D R O I D "; - write(fd, msg, strlen(msg)); - close(fd); - } + fd = open("/dev/tty0", O_WRONLY); + if (fd >= 0) { + const char *msg; + msg = "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" // console is 40 cols x 30 lines + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + " A N D R O I D "; + write(fd, msg, strlen(msg)); + close(fd); } + return 0; } @@ -868,6 +867,7 @@ struct selabel_handle* selinux_android_prop_context_handle(void) void selinux_init_all_handles(void) { sehandle = selinux_android_file_context_handle(); + selinux_android_set_sehandle(sehandle); sehandle_prop = selinux_android_prop_context_handle(); } @@ -1132,7 +1132,7 @@ int main(int argc, char **argv) continue; for (i = 0; i < fd_count; i++) { - if (ufds[i].revents == POLLIN) { + if (ufds[i].revents & POLLIN) { if (ufds[i].fd == get_property_set_fd()) handle_property_set_fd(); else if (ufds[i].fd == get_keychord_fd()) |