summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--initd/Makemodule.am2
-rw-r--r--initd/init.h12
-rw-r--r--initd/main.c3
-rw-r--r--initd/setup_tty.c40
4 files changed, 1 insertions, 56 deletions
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 <https://www.gnu.org/licenses/>.
- */
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#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;
-}