clone 470882 -1 reassign -1 ncurses retitle -1 ncurses should check the value returned by Gpm_GetEvent() thanks
Gerfried Fuchs, le Sat 22 Nov 2008 17:44:07 +0100, a écrit : > Ah, right. And aptitude does behave false here too (last two lines from > strace): > > write(2, "Uncaught exception: Unable to read from stdin: Bad file > descriptor\n"..., 67) = 67 > exit_group(-1) = ? > > I guess we need to clone the bug to there, too, or rather libncurses > through which it seems to use gpm, it doesn't directly depend on libgpm. Ah, right, doing so with a patch. > Not sure what other applications might be affected by it and should get > addressed, too ... Well, all the rdeps :/ Samuel
--- ncurses/base/lib_mouse.c.orig 2008-11-24 00:29:19.000000000 +0100 +++ ncurses/base/lib_mouse.c 2008-11-24 00:31:12.000000000 +0100 @@ -651,7 +651,15 @@ /* query server for event, return TRUE if we find one */ Gpm_Event ev; - if (my_Gpm_GetEvent(&ev) == 1) { + if (sp->_mouse_fd == -1) + break; + + switch (my_Gpm_GetEvent(&ev)) { + case 0: + /* Connection closed, drop the mouse. */ + sp->_mouse_fd = -1; + break; + case 1: /* there's only one mouse... */ eventp->id = NORMAL_EVENT; @@ -684,6 +692,7 @@ /* bump the next-free pointer into the circular list */ sp->_mouse_eventp = eventp = NEXT(eventp); result = TRUE; + break; } } break;