[PATCH evdev] Fix broken ButtonMapping option (#53168)

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 6 21:53:06 PDT 2012


Regression introduced in 8af0e6f1ebaf327f735bca507134b34bb24b26c6.
s is now initialized to NULL, so we never entered the loop.

X.Org Bug 53168 <http://bugs.freedesktop.org/show_bug.cgi?id=53168>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Not visible from the context, the code is essentially:

char *s = NULL;

while (s && ... ) {
   .. parse mapping
}

Which was fine before 8af0e6 when s was initialised to "". It's broken now
though.

 src/evdev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 6729f23..54772c7 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1665,7 +1665,7 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
 
         xf86IDrvMsg(pInfo, X_CONFIG, "ButtonMapping '%s'\n", mapping);
         map = mapping;
-        while (s && *s != '\0' && nbuttons < EVDEV_MAXBUTTONS)
+        do
         {
             btn = strtol(map, &s, 10);
 
@@ -1679,7 +1679,7 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
 
             pEvdev->btnmap[nbuttons++] = btn;
             map = s;
-        }
+        } while (s && *s != '\0' && nbuttons < EVDEV_MAXBUTTONS);
         free(mapping);
     }
 
-- 
1.7.10.4



More information about the xorg-devel mailing list