diff options
Diffstat (limited to 'usr.sbin/sysinstall/termcap.c')
-rw-r--r-- | usr.sbin/sysinstall/termcap.c | 13 |
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) { |