summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2017-01-22 15:18:04 +0100
committerAdam Jackson <ajax@redhat.com>2017-01-24 09:39:31 -0500
commit1142dd023acaac3cad96137aaf24c45b260e3ecd (patch)
tree227b8ef5634bc0b38eb60fe5a9edb90bf4425847
parentedd95182b26eb5d576d4878c559e0f17dddaa909 (diff)
downloadxorg-lib-libXinerama-1142dd023acaac3cad96137aaf24c45b260e3ecd.tar.gz
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 <ajax@redhat.com>
-rw-r--r--src/Xinerama.c1
1 files changed, 1 insertions, 0 deletions
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;
}