mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-21 03:38:14 +02:00
tools: Use xclose() over close()
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
e53a78f7d7
commit
8afdc52eaf
3 changed files with 9 additions and 8 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util-files.h"
|
||||
#include "util-list.h"
|
||||
#include "util-macros.h"
|
||||
#include "util-strings.h"
|
||||
|
|
@ -1358,7 +1359,7 @@ register_evdev_device(struct window *w, struct libinput_device *dev)
|
|||
g_io_add_watch(c, G_IO_IN, handle_event_evdev, d->libinput_device);
|
||||
fd = -1;
|
||||
out:
|
||||
close(fd);
|
||||
xclose(&fd);
|
||||
udev_device_unref(ud);
|
||||
}
|
||||
|
||||
|
|
@ -1376,7 +1377,7 @@ unregister_evdev_device(struct window *w, struct libinput_device *dev)
|
|||
free(libinput_device_get_user_data(d->libinput_device));
|
||||
libinput_device_unref(d->libinput_device);
|
||||
libevdev_free(d->evdev);
|
||||
close(d->fd);
|
||||
xclose(&d->fd);
|
||||
free(d);
|
||||
w->evdev.last_device = 0;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util-files.h"
|
||||
#include "util-input-event.h"
|
||||
#include "util-macros.h"
|
||||
#include "util-strings.h"
|
||||
|
|
@ -298,8 +299,7 @@ handle_device_removed(struct context *ctx, struct libinput_event *ev)
|
|||
libevdev_free(ctx->evdev);
|
||||
ctx->evdev = NULL;
|
||||
|
||||
close(ctx->fds[1].fd);
|
||||
ctx->fds[1].fd = -1;
|
||||
xclose(&ctx->fds[1].fd);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1721,7 +1721,7 @@ print_hid_report_descriptor(struct record_device *dev)
|
|||
iprintf(dev->fp, I_NONE, "\n");
|
||||
iprintf(dev->fp, I_DEVICE, "]\n");
|
||||
|
||||
close(fd);
|
||||
xclose(&fd);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2119,7 +2119,7 @@ destroy_source(struct record_context *ctx, struct source *source)
|
|||
{
|
||||
list_remove(&source->link);
|
||||
epoll_ctl(ctx->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
|
||||
close(source->fd);
|
||||
xclose(&source->fd);
|
||||
free(source);
|
||||
}
|
||||
|
||||
|
|
@ -2379,7 +2379,7 @@ mainloop(struct record_context *ctx)
|
|||
list_for_each_safe(source, &ctx->sources, link) {
|
||||
destroy_source(ctx, source);
|
||||
}
|
||||
close(ctx->epoll_fd);
|
||||
xclose(&ctx->epoll_fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2799,7 +2799,7 @@ out:
|
|||
struct hidraw *hidraw;
|
||||
|
||||
list_for_each_safe(hidraw, &d->hidraw_devices, link) {
|
||||
close(hidraw->fd);
|
||||
xclose(&hidraw->fd);
|
||||
list_remove(&hidraw->link);
|
||||
free(hidraw->name);
|
||||
free(hidraw);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue