summaryrefslogtreecommitdiff
path: root/app/xinput
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2015-06-20 09:54:59 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2015-06-20 09:54:59 +0000
commit70ce255848dcb87fd04c970a1707a1966136912b (patch)
tree4bb729c9b90abd421e8b47253afd65014a7a8f9f /app/xinput
parentfdb680e23d9ab98dbcbd7c64350b2eeea222144f (diff)
Merge from upstreams Fix crash for enable/disable without a device argument
commit 904a32d908219d6fea833576f7c31727bd3aea2f Author: Peter Hutterer <peter.hutterer@who-t.net> Date: Mon Nov 25 14:51:50 2013 +1000 Fix crash for enable/disable without a device argument Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'app/xinput')
-rw-r--r--app/xinput/src/property.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/xinput/src/property.c b/app/xinput/src/property.c
index 66a384285..bf04eeba4 100644
--- a/app/xinput/src/property.c
+++ b/app/xinput/src/property.c
@@ -832,12 +832,28 @@ int set_prop(Display *display, int argc, char *argv[], char *name,
int disable(Display *display, int argc, char *argv[], char *name, char *desc)
{
- char *new_argv[3] = { argv[0], "Device Enabled", "0" };
+ char *new_argv[3] = { NULL, "Device Enabled", "0" };
+
+ if (argc != 1) {
+ fprintf(stderr, "Usage: xinput %s %s\n", name, desc);
+ return EXIT_FAILURE;
+ }
+
+ new_argv[0] = argv[0];
+
return set_prop(display, 3, new_argv, name, desc);
}
int enable(Display *display, int argc, char *argv[], char *name, char *desc)
{
- char *new_argv[3] = { argv[0], "Device Enabled", "1" };
+ char *new_argv[3] = { NULL, "Device Enabled", "1" };
+
+ if (argc != 1) {
+ fprintf(stderr, "Usage: xinput %s %s\n", name, desc);
+ return EXIT_FAILURE;
+ }
+
+ new_argv[0] = argv[0];
+
return set_prop(display, 3, new_argv, name, desc);
}