summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chasedouglas@gmail.com>2009-11-09 22:54:39 -0500
committerKeith Packard <keithp@keithp.com>2009-11-10 18:33:05 -0800
commitb5aa2e0a5fe233dc883084a5026013472e85bca4 (patch)
tree240caf5ebe876c8548cbe413481903539656d22c
parent982f6648fd29d085265bf6035c1bf4d1b2499316 (diff)
Move FD_CLR above pInfo->read_input
The event fd may be invalidated by the pInfo->read_input call. If it is invalidated, the subsequent FD_CLR call will segfault. Thus, the FD_CLR call must precede the pInfo->read_input call. Signed-off-by: Chase Douglas <chasedouglas@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/common/xf86Events.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 9487fe7b2..8cd765a1c 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -263,13 +263,14 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
(FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
int sigstate = xf86BlockSIGIO();
- pInfo->read_input(pInfo);
- xf86UnblockSIGIO(sigstate);
/*
* Remove the descriptior from the set because more than one
* device may share the same file descriptor.
*/
FD_CLR(pInfo->fd, &devicesWithInput);
+
+ pInfo->read_input(pInfo);
+ xf86UnblockSIGIO(sigstate);
}
pInfo = pInfo->next;
}