[hackers] [dmenu] fix crash if negative monitor (< -1) was passed || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 26 Jul 2016 23:15:32 +0200 (CEST)

commit d14670b9959f8b3760b63dd40a70687a90312b8a
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jul 26 23:13:06 2016 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Tue Jul 26 23:13:06 2016 +0200

    fix crash if negative monitor (< -1) was passed
    
    for example: dmenu -m '-9001'

diff --git a/dmenu.c b/dmenu.c
index 8e84fbd..df51e76 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -541,7 +541,7 @@ setup(void)
 #ifdef XINERAMA
         if ((info = XineramaQueryScreens(dpy, &n))) {
                 XGetInputFocus(dpy, &w, &di);
- if (mon != -1 && mon < n)
+ if (mon >= 0 && mon < n)
                         i = mon;
                 else if (w != root && w != PointerRoot && w != None) {
                         /* find top-level window containing current input focus */
_AT_@ -558,7 +558,7 @@ setup(void)
                                         }
                 }
                 /* no focused window is on screen, so use pointer location instead */
- if (mon == -1 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
+ if (mon < 0 && !area && XQueryPointer(dpy, root, &dw, &dw, &x, &y, &di, &di, &du))
                         for (i = 0; i < n; i++)
                                 if (INTERSECT(x, y, 1, 1, info[i]))
                                         break;
Received on Tue Jul 26 2016 - 23:15:32 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 26 2016 - 23:24:16 CEST