From 43274e3910d2a910262d1192e663db1d983f8e54 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 7 Apr 2018 00:28:16 +0200 Subject: Remove setup_tty function Signed-off-by: David Oberhollenzer --- initd/Makemodule.am | 2 +- initd/init.h | 12 ------------ initd/main.c | 3 --- initd/setup_tty.c | 40 ---------------------------------------- 4 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 initd/setup_tty.c (limited to 'initd') diff --git a/initd/Makemodule.am b/initd/Makemodule.am index f6fa1da..692cdfb 100644 --- a/initd/Makemodule.am +++ b/initd/Makemodule.am @@ -1,4 +1,4 @@ -init_SOURCES = initd/main.c initd/runlst.c initd/init.h initd/setup_tty.c +init_SOURCES = initd/main.c initd/runlst.c initd/init.h init_SOURCES += initd/status.c initd/mksock.c initd/svclist.c init_CPPFLAGS = $(AM_CPPFLAGS) init_CFLAGS = $(AM_CFLAGS) diff --git a/initd/init.h b/initd/init.h index c8d16ba..878dc8d 100644 --- a/initd/init.h +++ b/initd/init.h @@ -62,18 +62,6 @@ int runlst_wait(exec_t *list, const char *ctty); */ pid_t runlst(exec_t *list, const char *ctty); -/********** setup_tty.c **********/ - -/* - Initial tty setup for init. Makes /dev/console our controlling tty and - reroutes all output there. Closes stdin because we presumably won't - need it anymore. - - Returns 0 on success, -1 on failure. The function takes care of - printing error messages on failure. -*/ -int setup_tty(void); - /********** status.c **********/ /* diff --git a/initd/main.c b/initd/main.c index 49bbee7..2be2045 100644 --- a/initd/main.c +++ b/initd/main.c @@ -225,9 +225,6 @@ int main(void) return EXIT_FAILURE; } - if (setup_tty()) - return EXIT_FAILURE; - memset(pfd, 0, sizeof(pfd)); pfd[0].fd = sfd; pfd[0].events = POLLIN; diff --git a/initd/setup_tty.c b/initd/setup_tty.c deleted file mode 100644 index 807b69d..0000000 --- a/initd/setup_tty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * Copyright (C) 2018 - David Oberhollenzer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include -#include -#include - -#include "init.h" - -int setup_tty(void) -{ - int fd; - - fd = open("/dev/console", O_WRONLY | O_NOCTTY); - if (fd < 0) { - perror("/dev/console"); - return -1; - } - - close(STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - - close(fd); - return 0; -} -- cgit v1.2.3