diff options
author | Matt Wilson <msw@redhat.com> | 1999-09-06 15:42:46 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-09-06 15:42:46 +0000 |
commit | b0029189860042358413db2d8217234bc993fcbe (patch) | |
tree | 84241bb2bc793edc5f03fe7dfb98ad1f01a97b25 | |
parent | 613543febf5408355e387449fcb7d8ec7057c6da (diff) | |
download | anaconda-b0029189860042358413db2d8217234bc993fcbe.tar.gz anaconda-b0029189860042358413db2d8217234bc993fcbe.tar.xz anaconda-b0029189860042358413db2d8217234bc993fcbe.zip |
redid controlling tty code
-rw-r--r-- | loader/init.c | 61 |
1 files changed, 23 insertions, 38 deletions
diff --git a/loader/init.c b/loader/init.c index 085556b20..a932d79a6 100644 --- a/loader/init.c +++ b/loader/init.c @@ -418,6 +418,7 @@ int main(void) { int cdRoot = 0; int doReboot = 0; int doShutdown =0; + int isSerial = 0; #ifdef __alpha__ char * kernel; #endif @@ -446,33 +447,39 @@ int main(void) { printf("done\n"); -#if 0 if (isSerial) { + printf("Red Hat install init version %s using a serial console\n", + VERSION); + + printf("remember, cereal is an important part of a nutritionally " + "balanced breakfast.\n\n"); + fd = open("/dev/ttyS0", O_RDWR, 0); if (fd < 0) { printf("failed to open /dev/ttyS0"); fatal_error(1); } - write(fd, "Switching to serial console...", 29); - /* gulp */ - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - - printf("done\n\n"); + setupTerminal(fd); - printf("Red Hat install init version %s using a serial console\n", - VERSION); - - printf("remember, cereal is an important part of a nutritionally " - "balanced breakfast.\n\n"); + close(fd); + } else { + fd = open("/dev/tty1", O_RDWR, 0); + if (fd < 0) { + printf("failed to open /dev/tty1"); + fatal_error(1); + } + } - setupTerminal(0); + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + close(fd); - close(fd); + setsid(); + if (ioctl(0, TIOCSCTTY, NULL)) { + printf("could not set new controlling tty"); } -#endif if (!testing) { sethostname("localhost.localdomain", 21); @@ -547,28 +554,6 @@ int main(void) { if (!(installpid = fork())) { /* child */ -#if 0 - if (!isSerial) { - fd = open("/dev/tty1", O_RDWR, 0); - if (fd < 0) { - printf("failed to open /dev/tty1"); - fatal_error(1); - } - - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - - setsid(); - if (ioctl(0, TIOCSCTTY, NULL)) { - printf("could not set new controlling tty"); - } - - setsid(); - close(fd); - } -#endif - *argvp++ = "/sbin/loader"; printf("running %s\n", argv[0]); |