mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 14:40:26 +01:00
tools: pass a valid grab parameter to list-devices
My kingdome for a compiler warning. Or a scan-build warning. Or a coverity warning. Or anything... But no, nothing. Also make the open_restricted() more robust to a NULL userdata, because effectively that's what we were passing here. Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/50 Introduced in0a13223c39Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit7c51c881dc)
This commit is contained in:
parent
7d8c546f58
commit
66e43ea6ea
2 changed files with 3 additions and 2 deletions
|
|
@ -372,6 +372,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
struct libinput *li;
|
||||
struct libinput_event *ev;
|
||||
bool grab = false;
|
||||
|
||||
/* This is kept for backwards-compatibility with the old
|
||||
libinput-list-devices */
|
||||
|
|
@ -388,7 +389,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
li = tools_open_backend(BACKEND_UDEV, "seat0", false, false);
|
||||
li = tools_open_backend(BACKEND_UDEV, "seat0", false, &grab);
|
||||
if (!li)
|
||||
return 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ open_restricted(const char *path, int flags, void *user_data)
|
|||
if (fd < 0)
|
||||
fprintf(stderr, "Failed to open %s (%s)\n",
|
||||
path, strerror(errno));
|
||||
else if (*grab && ioctl(fd, EVIOCGRAB, (void*)1) == -1)
|
||||
else if (grab && *grab && ioctl(fd, EVIOCGRAB, (void*)1) == -1)
|
||||
fprintf(stderr, "Grab requested, but failed for %s (%s)\n",
|
||||
path, strerror(errno));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue