Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Mar 2022 14:41:14 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4340df3418ec - stable/13 - libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.
Message-ID:  <202203051441.225EfE8l098653@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=4340df3418ecea57b5e48dec94ac4b1d4f760aca

commit 4340df3418ecea57b5e48dec94ac4b1d4f760aca
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-03-02 11:31:27 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-03-05 14:40:08 +0000

    libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.
    
    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            | 3 +++
 lib/libusb/libusb_global_linux.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c
index ffe0cf3f366a..ecfffde555aa 100644
--- a/lib/libusb/libusb10.c
+++ b/lib/libusb/libusb10.c
@@ -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);
 }
 
diff --git a/lib/libusb/libusb_global_linux.h b/lib/libusb/libusb_global_linux.h
index 9886bd4486f5..3e83bb2a6ea4 100644
--- a/lib/libusb/libusb_global_linux.h
+++ b/lib/libusb/libusb_global_linux.h
@@ -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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203051441.225EfE8l098653>