diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/devices.c | 9 | ||||
-rwxr-xr-x | init/init.c | 18 | ||||
-rwxr-xr-x | init/property_service.c | 6 |
3 files changed, 23 insertions, 10 deletions
diff --git a/init/devices.c b/init/devices.c index e25034c..69f5fc8 100644 --- a/init/devices.c +++ b/init/devices.c @@ -127,6 +127,7 @@ void fixup_sys_perms(const char *upath) char buf[512]; struct listnode *node; struct perms_ *dp; + char *secontext; /* upaths omit the "/sys" that paths in this list * contain, so we add 4 when comparing... @@ -148,6 +149,14 @@ void fixup_sys_perms(const char *upath) INFO("fixup %s %d %d 0%o\n", buf, dp->uid, dp->gid, dp->perm); chown(buf, dp->uid, dp->gid); chmod(buf, dp->perm); + if (sehandle) { + secontext = NULL; + selabel_lookup(sehandle, &secontext, buf, 0); + if (secontext) { + setfilecon(buf, secontext); + freecon(secontext); + } + } } } diff --git a/init/init.c b/init/init.c index 853762b..54adabb 100755 --- a/init/init.c +++ b/init/init.c @@ -93,7 +93,7 @@ void notify_service_state(const char *name, const char *state) } static int have_console; -static char *console_name = "/dev/console"; +static char console_name[PROP_VALUE_MAX] = "/dev/console"; static time_t process_needs_restart; static const char *ENV[32]; @@ -433,7 +433,7 @@ static void restart_processes() static void msg_start(const char *name) { - struct service *svc; + struct service *svc = NULL; char *tmp = NULL; char *args = NULL; @@ -441,11 +441,13 @@ static void msg_start(const char *name) svc = service_find_by_name(name); else { tmp = strdup(name); - args = strchr(tmp, ':'); - *args = '\0'; - args++; + if (tmp) { + args = strchr(tmp, ':'); + *args = '\0'; + args++; - svc = service_find_by_name(tmp); + svc = service_find_by_name(tmp); + } } if (svc) { @@ -550,11 +552,9 @@ static int keychord_init_action(int nargs, char **args) static int console_init_action(int nargs, char **args) { int fd; - char tmp[PROP_VALUE_MAX]; if (console[0]) { - snprintf(tmp, sizeof(tmp), "/dev/%s", console); - console_name = strdup(tmp); + snprintf(console_name, sizeof(console_name), "/dev/%s", console); } fd = open(console_name, O_RDWR); diff --git a/init/property_service.c b/init/property_service.c index 62b6c3d..e8c8869 100755 --- a/init/property_service.c +++ b/init/property_service.c @@ -352,7 +352,11 @@ int property_set(const char *name, const char *value) __futex_wake(&pa->serial, INT32_MAX); } else { pa = __system_property_area__; - if(pa->count == PA_COUNT_MAX) return -1; + if(pa->count == PA_COUNT_MAX) { + ERROR("Failed to set '%s'='%s', property pool is exhausted at %d entries", + name, value, PA_COUNT_MAX); + return -1; + } pi = pa_info_array + pa->count; pi->serial = (valuelen << 24); |