Commit 273ecfe introduces a bug where simple button mappings (e.g.
"set <id> button 2 3") ignore the final argument and always use '1'
instead. This us because the variable that we sscanf the button
number into is subsuquently reused as a loop control variable before
being sprintf'd out.

http://sourceforge.net/p/linuxwacom/mailman/message/34246572/

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 tools/xsetwacom.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index b9e8c0f..c1fec71 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1332,11 +1332,12 @@ static Bool parse_actions(Display *dpy, int argc, char 
**argv, unsigned long* da
        int  i = 0;
        int  nwords = 0;
        char **words = NULL;
+       int n;
        
        /* translate cmdline commands */
        words = strjoinsplit(argc, argv, &nwords);
 
-       if (nwords==1 && sscanf(words[0], "%d", &i) == 1)
+       if (nwords==1 && sscanf(words[0], "%d", &n) == 1)
        { /* Mangle "simple" button maps into proper actions */
                char *nargv[1];
                
@@ -1344,7 +1345,7 @@ static Bool parse_actions(Display *dpy, int argc, char 
**argv, unsigned long* da
                        free(words[i]);
                free(words);
                nargv[0] = alloca(32);
-               sprintf(nargv[0], "button +%d", i);
+               sprintf(nargv[0], "button +%d", n);
                words = strjoinsplit(1, nargv, &nwords);
        }
 
-- 
2.4.4


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to