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