git: 4981b8968d19 - main - libusb: consider bad fd as a broken event
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Jun 2025 12:40:10 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=4981b8968d19f009347ee8844770e84f9b83311e
commit 4981b8968d19f009347ee8844770e84f9b83311e
Author: SHENGYI HUNG <aokblast@FreeBSD.org>
AuthorDate: 2025-06-20 21:45:27 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2025-06-25 12:40:02 +0000
libusb: consider bad fd as a broken event
Application can use libusb_get_pollfds to get pollfds from libusb then
close the fd themselves. This cause the hotplug thread unable to leave
because it will be consider as a invalid event then loop forever instead
of a broken event that should be quit immediately.
Reviewed by: bapt
Sponsored by: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50959
---
lib/libusb/libusb10_hotplug.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/libusb/libusb10_hotplug.c b/lib/libusb/libusb10_hotplug.c
index f148e4dd43f5..369539d4512e 100644
--- a/lib/libusb/libusb10_hotplug.c
+++ b/lib/libusb/libusb10_hotplug.c
@@ -140,6 +140,8 @@ verify_event_validity(libusb_context *ctx)
return (valid_event);
return (invalid_event);
}
+ if (errno == EBADF)
+ return (broken_event);
return (invalid_event);
} else if (ctx->usb_event_mode == usb_event_devd) {
char buf[DEVCTL_MAXBUF];