From 32dcfafb3b8cdc22641254d50571b8be1d33fae3 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 4 Feb 2014 19:18:54 +0100 Subject: Fix comstart when the queue is empty Found by Coverity * i386/i386at/com.c (comstart): Make `nch' an int. When `getc' returns -1, just return. --- i386/i386at/com.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'i386') diff --git a/i386/i386at/com.c b/i386/i386at/com.c index e1ba71a..6edbca0 100644 --- a/i386/i386at/com.c +++ b/i386/i386at/com.c @@ -618,7 +618,7 @@ void comstart(tp) struct tty *tp; { - char nch; + int nch; #if 0 int i; #endif @@ -654,6 +654,8 @@ comst_4++; } #else nch = getc(&tp->t_outq); + if (nch == -1) + return; if ((nch & 0200) && ((tp->t_flags & LITOUT) == 0)) { timeout((timer_func_t *)ttrstrt, (char *)tp, (nch & 0x7f) + 6); tp->t_state |= TS_TIMEOUT; -- cgit v1.2.3