tags 493168 + patch thanks Hello,
Nico Schottelius, le Wed 06 Aug 2008 10:31:50 +0200, a écrit : > I'll backport the fix to 1.20.x and make a new release soon. > As soon as the compile error on 64 Bit Linux is fixed, there > will also be a new 1.99.x release. Here is a packport of the patch. Kurt, could you test it? Nico, note that I actually had to fix your patch: it was letting applications connect to vc MAX_NR_CONSOLES (the check was request->vc>MAX_NR_CONSOLES), while the array is only 0..MAX_NR_CONSOLES-1. Since VT number MAX_NR_CONSOLES indeed does exist, I've extended the array to 0..MAX_NR_CONSOLES and fixed the for loops accordingly. Samuel
diff -ur gpm-1.20.4-orig/src/daemon/gpm.c gpm-1.20.4/src/daemon/gpm.c --- gpm-1.20.4-orig/src/daemon/gpm.c 2008-05-29 01:26:08.000000000 +0200 +++ gpm-1.20.4/src/daemon/gpm.c 2008-10-07 23:13:45.000000000 +0200 @@ -98,7 +98,7 @@ int fifofd=-1; int eventFlag=0; -Gpm_Cinfo *cinfo[MAX_VC+1]; +Gpm_Cinfo *cinfo[MAX_NR_CONSOLES+1]; time_t last_selection_time; time_t opt_age_limit = 0; diff -ur gpm-1.20.4-orig/src/daemon/old_main.c gpm-1.20.4/src/daemon/old_main.c --- gpm-1.20.4-orig/src/daemon/old_main.c 2008-10-07 22:36:19.000000000 +0200 +++ gpm-1.20.4/src/daemon/old_main.c 2008-10-07 23:14:01.000000000 +0200 @@ -141,7 +141,7 @@ signal(SIGWINCH,gpm_killed); /* reinstall handler */ /* and notify clients */ - for(i=0; i<MAX_VC+1; i++) { + for(i=0; i<=MAX_NR_CONSOLES; i++) { Gpm_Cinfo *ci; for (ci = cinfo[i]; ci; ci = ci->next) kill(ci->data.pid,SIGWINCH); } @@ -214,7 +214,7 @@ /*........................ got request */ /* itz 10-22-96 check _all_ clients, not just those on top! */ - for (i=0; pending && (i<=MAX_VC); i++) { + for (i=0; pending && (i<=MAX_NR_CONSOLES); i++) { Gpm_Cinfo* ci; for (ci = cinfo[i]; pending && ci; ci = ci->next) { if (FD_ISSET(ci->fd,&selSet)) { diff -ur gpm-1.20.4-orig/src/daemon/processconn.c gpm-1.20.4/src/daemon/processconn.c --- gpm-1.20.4-orig/src/daemon/processconn.c 2008-05-29 01:26:09.000000000 +0200 +++ gpm-1.20.4/src/daemon/processconn.c 2008-10-07 23:07:53.000000000 +0200 @@ -70,8 +70,8 @@ return -1; } - if ((vc=request->vc)>MAX_VC) { - gpm_report(GPM_PR_DEBUG, GPM_MESS_REQUEST_ON, vc, MAX_VC); + if ((vc=request->vc)>MAX_NR_CONSOLES) { + gpm_report(GPM_PR_DEBUG, GPM_MESS_REQUEST_ON, vc, MAX_NR_CONSOLES); free(info); close(newfd); return -1; diff -ur gpm-1.20.4-orig/src/daemon/processrequest.c gpm-1.20.4/src/daemon/processrequest.c --- gpm-1.20.4-orig/src/daemon/processrequest.c 2008-05-29 01:26:09.000000000 +0200 +++ gpm-1.20.4/src/daemon/processrequest.c 2008-10-07 23:08:49.000000000 +0200 @@ -41,7 +41,7 @@ gpm_report(GPM_PR_INFO, GPM_MESS_CON_REQUEST, ci->fd, vc); - if (vc>MAX_VC) return -1; + if (vc>MAX_NR_CONSOLES) return -1; /* itz 10-22-96 this shouldn't happen now */ if (vc==-1) gpm_report(GPM_PR_OOPS, GPM_MESS_UNKNOWN_FD); Seulement dans gpm-1.20.4/src/headers: config.h diff -ur gpm-1.20.4-orig/src/headers/daemon.h gpm-1.20.4/src/headers/daemon.h --- gpm-1.20.4-orig/src/headers/daemon.h 2008-10-07 22:36:19.000000000 +0200 +++ gpm-1.20.4/src/headers/daemon.h 2008-10-07 23:14:01.000000000 +0200 @@ -26,6 +26,7 @@ */ #include "gpm.h" /* Gpm_Event */ #include <sys/select.h> /* fd_set */ +#include <linux/vt.h> /* for cinfo -- to be moved to os/linux in 2.x! */ /************************************************************************* * Types / structures @@ -102,13 +103,6 @@ * Macros */ -/* How many virtual consoles are managed? */ -#ifndef MAX_NR_CONSOLES -# define MAX_NR_CONSOLES 64 /* this is always sure */ -#endif - -#define MAX_VC MAX_NR_CONSOLES /* doesn't work before 1.3.77 */ - /* for adding a mouse; add_mouse */ #define GPM_ADD_DEVICE 0 #define GPM_ADD_TYPE 1 @@ -172,7 +166,7 @@ extern int eventFlag; extern struct winsize win; -extern Gpm_Cinfo *cinfo[MAX_VC+1]; +extern Gpm_Cinfo *cinfo[MAX_NR_CONSOLES+1]; extern struct mouse_features mouse_table[3], *which_mouse; /*the current one*/ diff -ur gpm-1.20.4-orig/src/headers/gpmCfg.h gpm-1.20.4/src/headers/gpmCfg.h --- gpm-1.20.4-orig/src/headers/gpmCfg.h 2008-05-29 01:26:09.000000000 +0200 +++ gpm-1.20.4/src/headers/gpmCfg.h 2008-10-07 23:03:10.000000000 +0200 @@ -32,14 +32,6 @@ #include <linux/tty.h> #endif -/* FIXME: still needed ?? */ -/* How many virtual consoles are managed? */ -#ifndef MAX_NR_CONSOLES -# define MAX_NR_CONSOLES 64 /* this is always sure */ -#endif - -#define MAX_VC MAX_NR_CONSOLES /* doesn't work before 1.3.77 */ - /* How many buttons may the mouse have? */ /* #define MAX_BUTTONS 3 ===> not used, it is hardwired :-( */ Seulement dans gpm-1.20.4-orig/src/headers: .gpm.h.swp Seulement dans gpm-1.20.4/src: Makefile