Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5934804 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman
Browse files

n_tty: Fix poll() when TIME_CHAR and MIN_CHAR == 0



Commit eafbe67f,
  n_tty: Refactor input_available_p() by call site
broke poll() when TIME_CHAR(tty) and MIN_CHAR(tty) are both 0.

When TIME_CHAR and MIN_CHAR are both 0, input is available if the
read_cnt is 1 (not 0).

Reported-by: default avatarEric Dumazet <edumazet@google.com>
Tested-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarStephane Eranian <eranian@google.com>
Tested-by: default avatarDavid Ahern <dsahern@gmail.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a64c1a1c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1896,7 +1896,7 @@ static int n_tty_open(struct tty_struct *tty)
static inline int input_available_p(struct tty_struct *tty, int poll)
{
	struct n_tty_data *ldata = tty->disc_data;
	int amt = poll && !TIME_CHAR(tty) ? MIN_CHAR(tty) : 1;
	int amt = poll && !TIME_CHAR(tty) && MIN_CHAR(tty) ? MIN_CHAR(tty) : 1;

	if (ldata->icanon && !L_EXTPROC(tty)) {
		if (ldata->canon_head != ldata->read_tail)