From 89c84575ea905c7598d6b6029c9209abe1cfb074 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 26 Aug 2005 07:24:21 +0000 Subject: [PATCH] Undo rate/period change after function body, so the damage doesn't leak into other functions. (Debian #050) --- hw/xfree86/os-support/linux/lnx_io.c | 11 ++++++++++- hw/xfree86/os-support/linux/lnx_kbd.c | 13 ++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c index 8d1fb456b..47df0dfb6 100644 --- a/hw/xfree86/os-support/linux/lnx_io.c +++ b/hw/xfree86/os-support/linux/lnx_io.c @@ -77,7 +77,9 @@ xf86GetKbdLeds() #include #endif -/* Deal with spurious kernel header change */ +/* Deal with spurious kernel header change in struct kbd_repeat. + We undo this define after the routine using that struct is over, + so as not to interfere with other 'rate' elements. */ #if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) # define rate period @@ -120,6 +122,13 @@ KDKBDREP_ioctl_ok(int rate, int delay) { #undef rate +/* Undo the earlier define for the struct kbd_repeat problem. */ +#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) +# undef rate +# endif +#endif + static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c index dd6773fff..b1fc95b56 100644 --- a/hw/xfree86/os-support/linux/lnx_kbd.c +++ b/hw/xfree86/os-support/linux/lnx_kbd.c @@ -107,7 +107,9 @@ GetKbdLeds(InputInfoPtr pInfo) #include #endif -/* Deal with spurious kernel header change */ +/* Deal with spurious kernel header change in struct kbd_repeat. + We undo this define after the routine using that struct is over, + so as not to interfere with other 'rate' elements. */ #if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) # define rate period @@ -151,6 +153,13 @@ KDKBDREP_ioctl_ok(int rate, int delay) { #undef rate +/* Undo the earlier define for the struct kbd_repeat problem. */ +#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) +# undef rate +# endif +#endif + static int KIOCSRATE_ioctl_ok(int rate, int delay) { #ifdef KIOCSRATE @@ -178,6 +187,8 @@ KIOCSRATE_ioctl_ok(int rate, int delay) { #endif /* KIOCSRATE */ } +#undef rate + static void SetKbdRepeat(InputInfoPtr pInfo, char rad) {