]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.
authorHans Petter Selasky <hselasky@FreeBSD.org>
Wed, 2 Mar 2022 11:31:27 +0000 (12:31 +0100)
committerHans Petter Selasky <hselasky@FreeBSD.org>
Sat, 5 Mar 2022 14:40:08 +0000 (15:40 +0100)
The LibUSB v1.0 emulation layer uses pipes internally to signal between
threads. When USB devices are reset, as part of loading firmware, SIGPIPE
may happen, and that is expected and should be ignored.

PR: 261891
Sponsored by: NVIDIA Networking

(cherry picked from commit d94d94e2c06b4331f706a3b4eca058041294ea05)

lib/libusb/libusb10.c
lib/libusb/libusb_global_linux.h

index ffe0cf3f366a844b21be6f1fda1de6f6e0110429..ecfffde555aae5210e6c19ef596ae538a1f698ea 100644 (file)
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <poll.h>
 #include <pthread.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -226,6 +227,8 @@ libusb_init(libusb_context **context)
 
        DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_init complete");
 
+       signal(SIGPIPE, SIG_IGN);
+
        return (0);
 }
 
index 9886bd4486f5177d2e5fe87808ce4b3c45c3f1d0..3e83bb2a6ea4ebbf5fd6bdd56d7d677f9b71d796 100644 (file)
@@ -50,6 +50,7 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <setjmp.h>
+#include <signal.h>
 #include <pthread.h>
 #include <sys/queue.h>
 #include <sys/ioctl.h>