summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/tty.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ed22e7a..05eb27d 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -263,12 +263,14 @@ ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
if (!tty_opened(tp)) {
/* Set proper termios flags. */
- if (TTY_CALLOUT(tp, dev)) {
+ if (TTY_CALLOUT(tp, dev))
tp->t_termios = tp->t_termios_init_out;
- } else {
+ else
tp->t_termios = tp->t_termios_init_in;
- }
ttydevsw_param(tp, &tp->t_termios);
+ /* Prevent modem control on callout devices and /dev/console. */
+ if (TTY_CALLOUT(tp, dev) || dev == dev_console)
+ tp->t_termios.c_cflag |= CLOCAL;
ttydevsw_modem(tp, SER_DTR|SER_RTS, 0);
@@ -281,9 +283,8 @@ ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
}
/* Wait for Carrier Detect. */
- if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 &&
- (tp->t_termios.c_cflag & CLOCAL) == 0 &&
- dev != dev_console) {
+ if ((oflags & O_NONBLOCK) == 0 &&
+ (tp->t_termios.c_cflag & CLOCAL) == 0) {
while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) {
error = tty_wait(tp, &tp->t_dcdwait);
if (error != 0)
OpenPOWER on IntegriCloud