summaryrefslogtreecommitdiff
path: root/term
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-12-12 19:44:38 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-12-12 19:44:38 +0000
commita074a25a39da6481a08761ca6a85e98216123e29 (patch)
tree18d41a52bb96934512676de052fa6ffc1048286a /term
parent2edfca04c4a09f1de19c1eceaae2096dac177b09 (diff)
(open_hook): Don't require carrier for opens that don't want to read
or write.
Diffstat (limited to 'term')
-rw-r--r--term/users.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/term/users.c b/term/users.c
index eb56ee70..0d7cb9ad 100644
--- a/term/users.c
+++ b/term/users.c
@@ -115,33 +115,36 @@ open_hook (struct trivfs_control *cntl,
}
/* Wait for carrier to turn on. */
- while (((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL))
- && !(flags & O_NONBLOCK)
- && !cancel)
+ if (flags & (O_READ|O_WRITE))
{
- err = (*bottom->assert_dtr) ();
- if (err)
+ while (((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL))
+ && !(flags & O_NONBLOCK)
+ && !cancel)
+ {
+ err = (*bottom->assert_dtr) ();
+ if (err)
+ {
+ mutex_unlock (&global_lock);
+ return err;
+ }
+ cancel = hurd_condition_wait (&carrier_alert, &global_lock);
+ }
+
+ if ((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL))
{
mutex_unlock (&global_lock);
- return err;
+ return EWOULDBLOCK;
+ }
+ if (cancel)
+ {
+ mutex_unlock (&global_lock);
+ return EINTR;
}
- cancel = hurd_condition_wait (&carrier_alert, &global_lock);
- }
- if ((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL))
- {
- mutex_unlock (&global_lock);
- return EWOULDBLOCK;
- }
- if (cancel)
- {
- mutex_unlock (&global_lock);
- return EINTR;
+ termflags |= TTY_OPEN;
+ if (!(termstate.c_cflag & CIGNORE))
+ (*bottom->set_bits) ();
}
-
- termflags |= TTY_OPEN;
- if (!(termstate.c_cflag & CIGNORE))
- (*bottom->set_bits) ();
mutex_unlock (&global_lock);
return 0;