]> diplodocus.org Git - xorg-xinput/commitdiff
test-xi2: check return value of list, exit on failure
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 26 Oct 2011 04:42:36 +0000 (14:42 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 10 Nov 2011 03:04:45 +0000 (13:04 +1000)
If list() fails, the server doesn't support XI2 or the device is invalid. In
either case, exit.

Fixes crashes when a nonexisting device is given.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/test_xi2.c

index 9ecfa1d5e864636b7397983f8995f4681f4d1200..e7fd99c914a8f204bedf5abd1f0fd886392413d1 100644 (file)
@@ -324,8 +324,12 @@ test_xi2(Display   *display,
     XIEventMask mask;
     Window win;
     int deviceid = -1;
     XIEventMask mask;
     Window win;
     int deviceid = -1;
+    int rc;
+
+    rc = list(display, argc, argv, name, desc);
+    if (rc != EXIT_SUCCESS)
+        return rc;
 
 
-    list(display, argc, argv, name, desc);
     if (argc >= 1) {
         XIDeviceInfo *info;
         info = xi2_find_device_info(display, argv[0]);
     if (argc >= 1) {
         XIDeviceInfo *info;
         info = xi2_find_device_info(display, argv[0]);