From: Stuart Kreitman <[email protected]>

http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6971649

Signed-off-by: Stuart Kreitman <[email protected]>
Signed-off-by: Alan Coopersmith <[email protected]>
---
 setxkbmap.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/setxkbmap.c b/setxkbmap.c
index 338b06c..e812a9c 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -397,7 +397,14 @@ parseArgs(int argc, char **argv)
         else if (streq(argv[i], "-config"))
             ok = setOptString(&i, argc, argv, CONFIG_NDX, FROM_CMD_LINE);
         else if (streq(argv[i], "-device"))
-            deviceSpec = atoi(argv[++i]); /* only allow device IDs, not names 
*/
+        {
+            if ( ++i < argc ) {
+                deviceSpec = atoi(argv[i]); /* only allow device IDs, not 
names */
+            } else {
+                usage(argc, argv);
+                exit(-1);
+            }
+        }
         else if (streq(argv[i], "-display"))
             ok = setOptString(&i, argc, argv, DISPLAY_NDX, FROM_CMD_LINE);
         else if (streq(argv[i], "-geometry"))
-- 
1.7.3.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to