Index: system.c =================================================================== RCS file: /usr/cvs/src/usr.sbin/sysinstall/system.c,v retrieving revision 1.111 diff -u -r1.111 system.c --- system.c 2001/07/09 09:24:03 1.111 +++ system.c 2001/09/05 02:24:30 @@ -61,6 +61,20 @@ return -1; } +/* + * Harvest children if we are init. + */ +static void +reap_children(int sig) +{ + pid_t pid; + int status; + + do { + pid = waitpid(-1, &status, WNOHANG); + } while (pid != 0); +} + static dialogMenuItem intrmenu[] = { { "Abort", "Abort the installation", NULL, intr_reboot }, { "Restart", "Restart the installation program", NULL, intr_restart }, @@ -119,28 +133,31 @@ if (!sysctlbyname("debug.boothowto", &boothowto, &i, NULL, NULL) && (i == sizeof(boothowto)) && (boothowto & RB_VERBOSE)) variable_set2(VAR_DEBUG, "YES", 0); + else + boothowto = 0; /* Are we running as init? */ if (getpid() == 1) { - int fd, type; + int fd; RunningAsInit = 1; setsid(); close(0); - fd = open("/dev/ttyv0", O_RDWR); - if (fd == -1) { - fd = open("/dev/console", O_RDWR); /* fallback */ + if (boothowto & RB_SERIAL) { + fd = open("/dev/console", O_RDWR); variable_set2(VAR_FIXIT_TTY, "serial", 0); /* give fixit a hint */ - } else + } else { + fd = open("/dev/ttyv0", O_RDWR); OnVTY = TRUE; + } /* * To make _sure_ we're on a VTY and don't have /dev/console switched * away to a serial port or something, attempt to set the cursor appearance. */ - type = 0; /* normal */ if (OnVTY) { - int fd2; + int fd2, type; + type = 0; /* normal */ if ((fd2 = open("/dev/console", O_RDWR)) != -1) { if (ioctl(fd2, CONS_CURSORTYPE, &type) == -1) { OnVTY = FALSE; @@ -166,6 +183,7 @@ i = 0; sysctlbyname("machdep.unaligned_print", NULL, 0, &i, sizeof(i)); #endif + signal(SIGCHLD, reap_children); } else { char hname[256];