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
This commit is contained in:
committed by
Baptiste Daroussin
parent
7176e1e3b5
commit
4981b8968d
@@ -140,6 +140,8 @@ verify_event_validity(libusb_context *ctx)
|
|||||||
return (valid_event);
|
return (valid_event);
|
||||||
return (invalid_event);
|
return (invalid_event);
|
||||||
}
|
}
|
||||||
|
if (errno == EBADF)
|
||||||
|
return (broken_event);
|
||||||
return (invalid_event);
|
return (invalid_event);
|
||||||
} else if (ctx->usb_event_mode == usb_event_devd) {
|
} else if (ctx->usb_event_mode == usb_event_devd) {
|
||||||
char buf[DEVCTL_MAXBUF];
|
char buf[DEVCTL_MAXBUF];
|
||||||
|
|||||||
Reference in New Issue
Block a user