From d62f16530488e6a771c4b902ed4eef70ee8b4178 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Thu, 12 Dec 1996 08:23:51 +0000 Subject: [PATCH] Fix some bogons in my close() handling. --- release/sysinstall/main.c | 10 +++++++--- release/sysinstall/network.c | 4 ++-- release/sysinstall/system.c | 4 ++-- usr.sbin/sade/main.c | 10 +++++++--- usr.sbin/sade/system.c | 4 ++-- usr.sbin/sysinstall/main.c | 10 +++++++--- usr.sbin/sysinstall/network.c | 4 ++-- usr.sbin/sysinstall/system.c | 4 ++-- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c index b5ebbb8bc83..90a43674027 100644 --- a/release/sysinstall/main.c +++ b/release/sysinstall/main.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: main.c,v 1.29 1996/12/11 09:35:02 jkh Exp $ + * $Id: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,7 +42,7 @@ static void screech(int sig) { - fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig); + printf("\007Fatal signal %d caught! I'm dead..\n", sig); if (RunningAsInit) pause(); else @@ -79,9 +79,13 @@ main(int argc, char **argv) } /* Try to preserve our scroll-back buffer */ - if (OnVTY) + if (OnVTY) { for (curr = 0; curr < 25; curr++) putchar('\n'); + /* Move stderr aside */ + if (DebugFD) + dup2(DebugFD, 2); + } /* Probe for all relevant devices on the system */ deviceGetAll(); diff --git a/release/sysinstall/network.c b/release/sysinstall/network.c index 2fc90dfe07b..8b342ff368d 100644 --- a/release/sysinstall/network.c +++ b/release/sysinstall/network.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: network.c,v 1.22 1996/12/09 15:16:36 jkh Exp $ + * $Id: network.c,v 1.23 1996/12/11 09:35:03 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -256,7 +256,7 @@ startPPP(Device *devp) struct termios foo; extern int login_tty(int); - for (i = getdtablesize(); i; i--) + for (i = getdtablesize(); i >= 0; i--) close(i); /* We're going over to VTY2 */ diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index 579a8566ef0..34240700156 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.67 1996/12/09 06:02:32 jkh Exp $ + * $Id: system.c,v 1.68 1996/12/11 19:35:26 jkh Exp $ * * Jordan Hubbard * @@ -300,7 +300,7 @@ systemCreateHoloshell(void) extern int login_tty(int); ioctl(0, TIOCNOTTY, NULL); - for (i = getdtablesize(); i; i--) + for (i = getdtablesize(); i >= 0; --i) close(i); fd = open("/dev/ttyv3", O_RDWR); ioctl(0, TIOCSCTTY, &fd); diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index b5ebbb8bc83..90a43674027 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: main.c,v 1.29 1996/12/11 09:35:02 jkh Exp $ + * $Id: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,7 +42,7 @@ static void screech(int sig) { - fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig); + printf("\007Fatal signal %d caught! I'm dead..\n", sig); if (RunningAsInit) pause(); else @@ -79,9 +79,13 @@ main(int argc, char **argv) } /* Try to preserve our scroll-back buffer */ - if (OnVTY) + if (OnVTY) { for (curr = 0; curr < 25; curr++) putchar('\n'); + /* Move stderr aside */ + if (DebugFD) + dup2(DebugFD, 2); + } /* Probe for all relevant devices on the system */ deviceGetAll(); diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 579a8566ef0..34240700156 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.67 1996/12/09 06:02:32 jkh Exp $ + * $Id: system.c,v 1.68 1996/12/11 19:35:26 jkh Exp $ * * Jordan Hubbard * @@ -300,7 +300,7 @@ systemCreateHoloshell(void) extern int login_tty(int); ioctl(0, TIOCNOTTY, NULL); - for (i = getdtablesize(); i; i--) + for (i = getdtablesize(); i >= 0; --i) close(i); fd = open("/dev/ttyv3", O_RDWR); ioctl(0, TIOCSCTTY, &fd); diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index b5ebbb8bc83..90a43674027 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: main.c,v 1.29 1996/12/11 09:35:02 jkh Exp $ + * $Id: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -42,7 +42,7 @@ static void screech(int sig) { - fprintf(stderr, "\007Fatal signal %d caught! I'm dead..\n", sig); + printf("\007Fatal signal %d caught! I'm dead..\n", sig); if (RunningAsInit) pause(); else @@ -79,9 +79,13 @@ main(int argc, char **argv) } /* Try to preserve our scroll-back buffer */ - if (OnVTY) + if (OnVTY) { for (curr = 0; curr < 25; curr++) putchar('\n'); + /* Move stderr aside */ + if (DebugFD) + dup2(DebugFD, 2); + } /* Probe for all relevant devices on the system */ deviceGetAll(); diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c index 2fc90dfe07b..8b342ff368d 100644 --- a/usr.sbin/sysinstall/network.c +++ b/usr.sbin/sysinstall/network.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: network.c,v 1.22 1996/12/09 15:16:36 jkh Exp $ + * $Id: network.c,v 1.23 1996/12/11 09:35:03 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -256,7 +256,7 @@ startPPP(Device *devp) struct termios foo; extern int login_tty(int); - for (i = getdtablesize(); i; i--) + for (i = getdtablesize(); i >= 0; i--) close(i); /* We're going over to VTY2 */ diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 579a8566ef0..34240700156 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.67 1996/12/09 06:02:32 jkh Exp $ + * $Id: system.c,v 1.68 1996/12/11 19:35:26 jkh Exp $ * * Jordan Hubbard * @@ -300,7 +300,7 @@ systemCreateHoloshell(void) extern int login_tty(int); ioctl(0, TIOCNOTTY, NULL); - for (i = getdtablesize(); i; i--) + for (i = getdtablesize(); i >= 0; --i) close(i); fd = open("/dev/ttyv3", O_RDWR); ioctl(0, TIOCSCTTY, &fd);