From 609039e67ef62f3e4efd0e04572bdcd86ea45d34 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Oct 2011 14:42:36 +1000 Subject: [PATCH] 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 --- src/test_xi2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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]); -- 2.56.0