Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/sysinst Check the return code of subwin and ne...
details: https://anonhg.NetBSD.org/src/rev/f1a3ce2c546e
branches: trunk
changeset: 473814:f1a3ce2c546e
user: garbled <garbled%NetBSD.org@localhost>
date: Sun Jun 20 04:17:57 1999 +0000
description:
Check the return code of subwin and newwin for NULL.
diffstat:
distrib/utils/sysinst/main.c | 7 ++++++-
distrib/utils/sysinst/run.c | 17 ++++++++++++++++-
distrib/utils/sysinst/util.c | 7 +++++--
3 files changed, 27 insertions(+), 4 deletions(-)
diffs (76 lines):
diff -r 6fb41dac1129 -r f1a3ce2c546e distrib/utils/sysinst/main.c
--- a/distrib/utils/sysinst/main.c Sun Jun 20 02:15:22 1999 +0000
+++ b/distrib/utils/sysinst/main.c Sun Jun 20 04:17:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.15 1999/06/19 06:52:22 cgd Exp $ */
+/* $NetBSD: main.c,v 1.16 1999/06/20 04:17:57 garbled Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -118,6 +118,11 @@
* XXX window will be overwritten by menus.
*/
win = newwin(getmaxy(stdscr) - 2, getmaxx(stdscr) - 2, 1, 1);
+ if (win == NULL) {
+ (void)fprintf(stderr,
+ "sysinst: screen too small\n");
+ exit(1);
+ }
msg_window(win);
/* Watch for SIGINT and clean up */
diff -r 6fb41dac1129 -r f1a3ce2c546e distrib/utils/sysinst/run.c
--- a/distrib/utils/sysinst/run.c Sun Jun 20 02:15:22 1999 +0000
+++ b/distrib/utils/sysinst/run.c Sun Jun 20 04:17:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: run.c,v 1.14 1999/04/13 14:49:56 bouyer Exp $ */
+/* $NetBSD: run.c,v 1.15 1999/06/20 04:17:57 garbled Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -440,9 +440,24 @@
wclear(stdscr); /* XXX shouldn't be needed */
wrefresh(stdscr);
statuswin = subwin(stdscr, win.ws_row, win.ws_col, 0, 0);
+ if (statuswin == NULL) {
+ fprintf(stderr, "sysinst: failed to allocate"
+ " status window.\n");
+ exit(1);
+ }
boxwin = subwin(statuswin, win.ws_row - 3, win.ws_col, 3, 0);
+ if (boxwin == NULL) {
+ fprintf(stderr, "sysinst: failed to allocate"
+ " status box.\n");
+ exit(1);
+ }
actionwin = subwin(statuswin, win.ws_row - 5, win.ws_col - 3,
4, 1);
+ if (actionwin == NULL) {
+ fprintf(stderr, "sysinst: failed to allocate"
+ " output window.\n");
+ exit(1);
+ }
scrollok(actionwin, TRUE);
win.ws_col -= 3;
diff -r 6fb41dac1129 -r f1a3ce2c546e distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c Sun Jun 20 02:15:22 1999 +0000
+++ b/distrib/utils/sysinst/util.c Sun Jun 20 04:17:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.40 1999/04/18 04:09:27 simonb Exp $ */
+/* $NetBSD: util.c,v 1.41 1999/06/20 04:17:57 garbled Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -866,7 +866,10 @@
int c, found;
yesnowin = subwin(stdscr, 5, 20, getmaxy(stdscr)/2 - 2, getmaxx(stdscr)/2 - 10);
-
+ if (yesnowin == NULL) {
+ fprintf(stderr, "sysinst: failed to allocate yes/no box\n");
+ exit(1);
+ }
box(yesnowin, '*', '*');
wmove(yesnowin, 2,2);
Home |
Main Index |
Thread Index |
Old Index