libusbx/SOURCES/0004-Linux-Improved-system-out-of-memory-handling.patch
2021-09-09 21:08:35 +00:00

37 lines
1.1 KiB
Diff

From d3018d249a98fcf93d36baec32b80b7ef5a8ee68 Mon Sep 17 00:00:00 2001
From: Slash Gordon <slash.gordon.dev@gmail.com>
Date: Tue, 3 Dec 2019 12:47:38 +0100
Subject: [PATCH 04/10] Linux: Improved system out of memory handling
Maps ENOMEM system error to LIBUSB_ERROR_NO_MEM.
(cherry picked from commit 97ece77c4a6eaafd0a74fd3b73e290ec97d71eb5)
---
libusb/os/linux_usbfs.c | 2 ++
libusb/version_nano.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index dace935..53530cd 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -2079,6 +2079,8 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer)
if (r < 0) {
if (errno == ENODEV) {
r = LIBUSB_ERROR_NO_DEVICE;
+ } else if (errno == ENOMEM) {
+ r = LIBUSB_ERROR_NO_MEM;
} else {
usbi_err(TRANSFER_CTX(transfer),
"submiturb failed error %d errno=%d", r, errno);
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index aebe182..41a03d1 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11411
+#define LIBUSB_NANO 11412
--
2.26.1