mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-06-10 00:58:31 +02:00
tools/debug-tablet: guard against open() failures
This is a debugging tool so we don't expect NDEBUG but let's handle errors correctly anyway. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1467>
This commit is contained in:
parent
0fa334600d
commit
86a775b3ca
1 changed files with 6 additions and 2 deletions
|
|
@ -277,8 +277,12 @@ handle_device_added(struct context *ctx, struct libinput_event *ev)
|
|||
devnode = udev_device_get_devnode(udev_device);
|
||||
if (devnode) {
|
||||
int fd = open(devnode, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
assert(fd != -1);
|
||||
assert(libevdev_new_from_fd(fd, &ctx->evdev) == 0);
|
||||
if (fd == -1)
|
||||
return;
|
||||
if (libevdev_new_from_fd(fd, &ctx->evdev) != 0) {
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
ctx->fds[1].fd = fd;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue