Ticket #3208: fix failed gpm connect for vc /dev/tty0.

How to reproduce the bug:

* compile mc with gpm support
* run the gpm daemon on the console
* login to the machine with ssh from console on another machine
* run mc

At this situation, keyboard response will be sluggish and mc will consume
CPU time when idle. The reason is that mc is trying to reopen the Gpm
connection over and over again and gpm will try to close the connection
over and over again (because the user is not on the local console).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Mikulas Patocka 2019-03-02 14:26:30 +03:00 committed by Andrew Borodin
parent 673dd73ac0
commit d1fd9f2303

View File

@ -2091,14 +2091,13 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
*event = ev;
return EV_MOUSE;
}
else if (status == 0) /* connection closed; -1 == error */
else if (status <= 0) /* connection closed; -1 == error */
{
if (mouse_fd >= 0 && FD_ISSET (mouse_fd, &select_set))
FD_CLR (mouse_fd, &select_set);
/* Try to reopen gpm_mouse connection */
disable_mouse ();
enable_mouse ();
return EV_NONE;
}
}
}