Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3be5c95d authored by Colin Cross's avatar Colin Cross Committed by Android Git Automerger
Browse files

am a5ca229a: am 1615c09a: Merge "init: Fix potential null pointer issue"

* commit 'a5ca229a':
  init: Fix potential null pointer issue
parents 30874aff a5ca229a
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -90,7 +90,7 @@ void notify_service_state(const char *name, const char *state)
}
}


static int have_console;
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 time_t process_needs_restart;


static const char *ENV[32];
static const char *ENV[32];
@@ -430,7 +430,7 @@ static void restart_processes()


static void msg_start(const char *name)
static void msg_start(const char *name)
{
{
    struct service *svc;
    struct service *svc = NULL;
    char *tmp = NULL;
    char *tmp = NULL;
    char *args = NULL;
    char *args = NULL;


@@ -438,12 +438,14 @@ static void msg_start(const char *name)
        svc = service_find_by_name(name);
        svc = service_find_by_name(name);
    else {
    else {
        tmp = strdup(name);
        tmp = strdup(name);
        if (tmp) {
            args = strchr(tmp, ':');
            args = strchr(tmp, ':');
            *args = '\0';
            *args = '\0';
            args++;
            args++;


            svc = service_find_by_name(tmp);
            svc = service_find_by_name(tmp);
        }
        }
    }


    if (svc) {
    if (svc) {
        service_start(svc, args);
        service_start(svc, args);
@@ -547,11 +549,9 @@ static int keychord_init_action(int nargs, char **args)
static int console_init_action(int nargs, char **args)
static int console_init_action(int nargs, char **args)
{
{
    int fd;
    int fd;
    char tmp[PROP_VALUE_MAX];


    if (console[0]) {
    if (console[0]) {
        snprintf(tmp, sizeof(tmp), "/dev/%s", console);
        snprintf(console_name, sizeof(console_name), "/dev/%s", console);
        console_name = strdup(tmp);
    }
    }


    fd = open(console_name, O_RDWR);
    fd = open(console_name, O_RDWR);