Hi

I am submitting this patch for Midnight Commander bug 743566 in Debian.

The patch is already in the upstream mc repository at
https://github.com/MidnightCommander/mc

It would be nice if the fix could make it to Buster.

Mikulas
commit d1fd9f2303e91f9bb054c44fdccb946a19ca6cb4
Author: Mikulas Patocka <mpato...@redhat.com>
Date:   Sat Mar 2 14:26:30 2019 +0300

    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 <mpato...@redhat.com>
    Signed-off-by: Andrew Borodin <aboro...@vmail.ru>

diff --git a/lib/tty/key.c b/lib/tty/key.c
index 8bfd4dc16..bfb2ea633 100644
--- a/lib/tty/key.c
+++ b/lib/tty/key.c
@@ -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;
                     }
                 }
             }

Reply via email to