Commit 904a32d9 authored by Peter Hutterer's avatar Peter Hutterer

Fix crash for enable/disable without a device argument

Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
parent 68e48872
......@@ -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);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment