From 4c3a11131fc80507a75d17baca73081247a33133 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Tue, 31 Oct 2017 20:56:48 +0100 Subject: [PATCH] Minor cleanup + use strlen() rather than sizeof() on const strings Signed-off-by: Joachim Nilsson --- src/exec.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/exec.c b/src/exec.c index 2f4d192c..314fcc7f 100644 --- a/src/exec.c +++ b/src/exec.c @@ -269,11 +269,12 @@ static void prepare_tty(char *tty, speed_t speed, char *procname) sigaction(SIGHUP, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGQUIT, &sa, NULL); + + /* Create new session and process group */ setsid(); - /* Set INIT_PROCESS UTMP entry */ + /* Finit is responsible for the UTMP INIT_PROCESS record */ utmp_set_init(tty, 0); - prctl(PR_SET_NAME, procname, 0, 0, 0); } @@ -305,20 +306,20 @@ static int activate_console(int noclear, int nowait) continue; } - (void)write(STDERR_FILENO, clr, sizeof(clr)); - (void)write(STDERR_FILENO, msg, sizeof(msg)); + (void)write(STDERR_FILENO, clr, strlen(clr)); + (void)write(STDERR_FILENO, msg, strlen(msg)); while (read(STDIN_FILENO, &c, 1) == 1 && c != '\n') continue; if (fexist(SYNC_STOPPED)) continue; - (void)write(STDERR_FILENO, clr, sizeof(clr)); + (void)write(STDERR_FILENO, clr, strlen(clr)); ret = 1; break; } - /* Restore ECHO, XON/OFF while waiting for */ + /* Restore ECHO, XON/OFF */ if (!tcgetattr(STDIN_FILENO, &term)) { term.c_iflag |= IXON|IXOFF; term.c_lflag |= ECHO;