From 1142dd023acaac3cad96137aaf24c45b260e3ecd Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Sun, 22 Jan 2017 15:18:04 +0100 Subject: libXinerama: Set number of screens to 0 on error The documentation of XineramaQueryScreens states that number is always set to the amount of screens in the returned array, but if the communication with the X server fails, NULL is returned without modifying number. At least dwm relies on the fact that number is set to 0 on error, i.e. when NULL is returned. As a NULL pointer contains 0 elements and the documentation states that number contains the amount of elements of the returned array, I think this should be fixed inside libXinerama. Reviewed-by: Adam Jackson --- src/Xinerama.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Xinerama.c b/src/Xinerama.c index 8472ec5..ee1f630 100644 --- a/src/Xinerama.c +++ b/src/Xinerama.c @@ -286,6 +286,7 @@ XineramaQueryScreens( if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay (dpy); SyncHandle (); + *number = 0; return NULL; } -- cgit v1.2.1