From: Peter Hutterer Date: Wed, 26 Oct 2011 04:42:36 +0000 (+1000) Subject: test-xi2: check return value of list, exit on failure X-Git-Url: https://diplodocus.org/git/xorg-xinput/commitdiff_plain/609039e67ef62f3e4efd0e04572bdcd86ea45d34?hp=9c3baacbd819eae122a4c0b679efc3c36895cff9 test-xi2: check return value of list, exit on failure 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 --- diff --git a/src/test_xi2.c b/src/test_xi2.c index 9ecfa1d..e7fd99c 100644 --- a/src/test_xi2.c +++ b/src/test_xi2.c @@ -324,8 +324,12 @@ test_xi2(Display *display, 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]);