git: 8d2996f51927 - main - sysutils/nut: Remove unnecessary validation for bus_num
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Nov 2023 16:06:02 UTC
The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=8d2996f519277001777d07bd61c9cdab77a5c334 commit 8d2996f519277001777d07bd61c9cdab77a5c334 Author: Xin LI <delphij@FreeBSD.org> AuthorDate: 2023-11-24 15:52:06 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2023-11-24 16:03:39 +0000 sysutils/nut: Remove unnecessary validation for bus_num The libusb_get_bus_number() function serves as a simple accessor for the bus number of the opaque device struct. Unlike libusb_get_port_number(), it does not have the ability to convey errors back to the caller, and a bus number of 0 is a valid value. Therefore, any validation around bus_num is redundant. This commit removes the unnecessary validation code related to bus_num. Signed-off-by: Xin LI <delphij@FreeBSD.org> PR: 275293 Upstream commit: 4aeb199eb Upstream Pull Request: https://github.com/networkupstools/nut/pull/2198/ --- sysutils/nut/Makefile | 2 +- sysutils/nut/files/patch-drivers_libusb1.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile index a22dd514509b..d179892a49e1 100644 --- a/sysutils/nut/Makefile +++ b/sysutils/nut/Makefile @@ -1,6 +1,6 @@ PORTNAME= nut PORTVERSION= 2.8.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/ diff --git a/sysutils/nut/files/patch-drivers_libusb1.c b/sysutils/nut/files/patch-drivers_libusb1.c new file mode 100644 index 000000000000..8e778ecf8707 --- /dev/null +++ b/sysutils/nut/files/patch-drivers_libusb1.c @@ -0,0 +1,18 @@ +--- drivers/libusb1.c.orig 2023-11-24 07:19:04.377537000 -0800 ++++ drivers/libusb1.c 2023-11-24 07:20:06.065188000 -0800 +@@ -263,14 +263,7 @@ + libusb_free_device_list(devlist, 1); + fatal_with_errno(EXIT_FAILURE, "Out of memory"); + } +- if (bus_num > 0) { +- sprintf(curDevice->Bus, "%03d", bus_num); +- } else { +- upsdebugx(1, "%s: invalid libusb bus number %i", +- __func__, bus_num); +- free(curDevice->Bus); +- curDevice->Bus = NULL; +- } ++ sprintf(curDevice->Bus, "%03d", bus_num); + + device_addr = libusb_get_device_address(device); + curDevice->Device = (char *)malloc(4);