From 49fb7f52e5488f7b13702d40e94b1b05c6cb2fb5 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 5 May 2017 19:57:15 +0200 Subject: [PATCH] Don't clobber loop variable with return value Fixes bug 6383. --- openbox/screen.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openbox/screen.c b/openbox/screen.c index e758ada1..31cb8ded 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1903,18 +1903,21 @@ guint screen_monitor_pointer() gboolean screen_pointer_pos(gint *x, gint *y) { - Window w; gint i; - guint u; gboolean ret; + /* we don't care about any of these return values, but we can't pass NULL */ + Window w; + guint u; + gint j; + ret = !!XQueryPointer(obt_display, obt_root(ob_screen), - &w, &w, x, y, &i, &i, &u); + &w, &w, x, y, &j, &j, &u); if (!ret) { for (i = 0; i < ScreenCount(obt_display); ++i) if (i != ob_screen) - if (XQueryPointer(obt_display, obt_root(i), - &w, &w, x, y, &i, &i, &u)) + if ((ret=XQueryPointer(obt_display, obt_root(i), + &w, &w, x, y, &j, &j, &u))) break; } return ret; -- 2.34.1