summaryrefslogtreecommitdiff
path: root/freebsd-2.0
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>1995-05-02 01:00:44 +0000
committerPaul Mackerras <paulus@samba.org>1995-05-02 01:00:44 +0000
commit29aef83eca8130891aafe73bf32c4e5463393d0f (patch)
tree4c1f2dcfda14fd9ea769072feacd21cf0abf97a3 /freebsd-2.0
parent3091c278c053367175beefb683f8831fcd2939f6 (diff)
downloadppp-29aef83eca8130891aafe73bf32c4e5463393d0f.tar.gz
fix wait loop in read proc
Diffstat (limited to 'freebsd-2.0')
-rw-r--r--freebsd-2.0/ppp_tty.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/freebsd-2.0/ppp_tty.c b/freebsd-2.0/ppp_tty.c
index 1a07337..1f22821 100644
--- a/freebsd-2.0/ppp_tty.c
+++ b/freebsd-2.0/ppp_tty.c
@@ -70,7 +70,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
-/* $Id: ppp_tty.c,v 1.1 1994/12/15 22:28:09 paulus Exp $ */
+/* $Id: ppp_tty.c,v 1.2 1995/05/02 01:00:44 paulus Exp $ */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
#include "ppp.h"
@@ -287,12 +287,25 @@ pppread(tp, uio, flag)
register int s;
int error = 0;
- if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0)
- return 0; /* end of file */
- if (sc == NULL || tp != (struct tty *) sc->sc_devp)
+ if (sc == NULL)
return 0;
+ /*
+ * Loop waiting for input, checking that nothing disasterous
+ * happens in the meantime.
+ */
s = splimp();
- while (sc->sc_inq.ifq_head == NULL && tp->t_line == PPPDISC) {
+ for (;;) {
+ if (tp != (struct tty *) sc->sc_devp || tp->t_line != PPPDISC) {
+ splx(s);
+ return 0;
+ }
+ if (sc->sc_inq.ifq_head != NULL)
+ break;
+ if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0
+ && (tp->t_state & TS_ISOPEN)) {
+ splx(s);
+ return 0; /* end of file */
+ }
if (tp->t_state & TS_ASYNC || flag & IO_NDELAY) {
splx(s);
return (EWOULDBLOCK);
@@ -303,10 +316,6 @@ pppread(tp, uio, flag)
return error;
}
}
- if (tp->t_line != PPPDISC) {
- splx(s);
- return (-1);
- }
/* Pull place-holder byte out of canonical queue */
getc(&tp->t_canq);