summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-05-26 01:09:59 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-05-26 01:09:59 +0200
commitc7efce2d405bc49efc159b9f25b86052a7b0c584 (patch)
tree9954adb8a6b6cc288334f8e76d7f63aebd13dbe8
parentf044547a073303e0268481211c7d06373ca85011 (diff)
Cope with getc returning -1
* i386/i386at/lpr.c (lprstart): Use int instead of char to store result of getc, so as to return in case of getting -1.
-rw-r--r--i386/i386at/lpr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index 73c4261b..8303be59 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -232,7 +232,7 @@ void lprstart(struct tty *tp)
spl_t s = spltty();
u_short addr = (natural_t) tp->t_addr;
int status = inb(STATUS(addr));
- char nch;
+ int nch;
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) {
splx(s);
@@ -253,6 +253,10 @@ void lprstart(struct tty *tp)
return;
}
nch = getc(&tp->t_outq);
+ if (nch == -1) {
+ splx(s);
+ return;
+ }
if ((tp->t_flags & LITOUT) == 0 && (nch & 0200)) {
timeout((timer_func_t *)ttrstrt, (char *)tp, (nch & 0x7f) + 6);
tp->t_state |= TS_TIMEOUT;