[PATCH] Initialize the fd to -1 for xorg.conf input devices.

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 19 16:00:18 PDT 2011


For hotplugged devices, xf86AllocateInput does that for us but the xorg.conf
path is different. Since not all drivers reset the fd during PreInit but may
still call close(pInfo->fd) in all cases, this can terminate the logging
early.

Reproducible: add a wacom driver InputDevice section with no Option Device.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
I would like to point out that 
http://lists.freedesktop.org/archives/xorg-devel/2011-July/023824.html and
http://lists.freedesktop.org/archives/xorg-devel/2011-July/023765.html are
equally unloved and nonetheless crash the server.

Jeremy: all three are 1.10.x candidates.

 hw/xfree86/common/xf86Config.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index ccfad95..7f3316a 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1223,6 +1223,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 			      (count + 1) * sizeof(InputInfoPtr));
             devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
             Pointer.type_name = XI_MOUSE;
+            Pointer.fd = -1;
 	    *devs[count - 1] = Pointer;
 	    devs[count - 1]->options =
 				xf86addNewOption(devs[count -1]->options,
@@ -1269,6 +1270,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 			      (count + 1) * sizeof(InputInfoPtr));
             devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
             Pointer.type_name = XI_MOUSE;
+            Pointer.fd = -1;
 	    *devs[count - 1] = Pointer;
 	    devs[count - 1]->options =
 				xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
@@ -1366,6 +1368,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 			      (count + 1) * sizeof(InputInfoPtr));
             devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
             Keyboard.type_name = XI_KEYBOARD;
+            Keyboard.fd = -1;
 	    *devs[count - 1] = Keyboard;
 	    devs[count - 1]->options =
 				xf86addNewOption(devs[count - 1]->options,
-- 
1.7.6



More information about the xorg-devel mailing list