summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/termcap.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-09-16 10:14:23 +0000
committerjkh <jkh@FreeBSD.org>1997-09-16 10:14:23 +0000
commitd387f3a0a99b84c361775c58a44002ed3511c815 (patch)
tree0a3cae00e9faa8ad5df5d833845a3dbf728e63b4 /usr.sbin/sysinstall/termcap.c
parent1bd32b987b7336e1c1c99ba6a70f36b84af119ed (diff)
downloadFreeBSD-src-d387f3a0a99b84c361775c58a44002ed3511c815.zip
FreeBSD-src-d387f3a0a99b84c361775c58a44002ed3511c815.tar.gz
MF22: pst's changes.
Submitted by: pst
Diffstat (limited to 'usr.sbin/sysinstall/termcap.c')
-rw-r--r--usr.sbin/sysinstall/termcap.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c
index fa9c19f..1569479 100644
--- a/usr.sbin/sysinstall/termcap.c
+++ b/usr.sbin/sysinstall/termcap.c
@@ -94,17 +94,20 @@ set_termcap(void)
if (setenv("TERMCAP", termcap, 1) < 0)
return -1;
}
- if (DebugFD == -1)
- DebugFD = dup(1);
+ if (DebugFD < 0)
+ DebugFD = open("/dev/null", O_RDWR, 0);
}
else {
int i, on;
if (getpid() == 1) {
DebugFD = open("/dev/ttyv1", O_WRONLY);
- on = 1;
- i = ioctl(DebugFD, TIOCCONS, (char *)&on);
- msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno));
+ if (DebugFD != -1) {
+ on = 1;
+ i = ioctl(DebugFD, TIOCCONS, (char *)&on);
+ msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n",
+ DebugFD, i, !i ? "success" : strerror(errno));
+ }
}
if (ColorDisplay) {
if (!term) {
OpenPOWER on IntegriCloud