You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.0 KiB
62 lines
2.0 KiB
From 0b10420084b93572b1fec091d1ca4948c6cbba62 Mon Sep 17 00:00:00 2001 |
|
From: Christian Wiese <christian.wiese@securepoint.de> |
|
Date: Thu, 25 Apr 2013 15:10:00 +0200 |
|
Subject: [PATCH] nut-scanner: fix scan_usb to remove trailing spaces from |
|
output strings |
|
|
|
This patch uses rtrim() from libcommon to remove trailing spaces from |
|
serialnumber, device_name and vendor_name. |
|
|
|
see: https://github.com/networkupstools/nut/issues/26 |
|
--- |
|
tools/nut-scanner/Makefile.am | 2 +- |
|
tools/nut-scanner/scan_usb.c | 6 +++--- |
|
2 files changed, 4 insertions(+), 4 deletions(-) |
|
|
|
diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am |
|
index d4066d2..87fb6ed 100644 |
|
--- a/tools/nut-scanner/Makefile.am |
|
+++ b/tools/nut-scanner/Makefile.am |
|
@@ -17,7 +17,7 @@ libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL |
|
|
|
nut_scanner_SOURCES = nut-scanner.c |
|
nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include |
|
-nut_scanner_LDADD = libnutscan.la |
|
+nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la |
|
|
|
if WITH_SSL |
|
libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS) |
|
diff --git a/tools/nut-scanner/scan_usb.c b/tools/nut-scanner/scan_usb.c |
|
index d6e1e4e..1a4bb24 100644 |
|
--- a/tools/nut-scanner/scan_usb.c |
|
+++ b/tools/nut-scanner/scan_usb.c |
|
@@ -177,7 +177,7 @@ nutscan_device_t * nutscan_scan_usb() |
|
dev->descriptor.iSerialNumber, |
|
string, sizeof(string)); |
|
if (ret > 0) { |
|
- serialnumber = strdup(string); |
|
+ serialnumber = strdup(rtrim(string, ' ')); |
|
} |
|
} |
|
/* get product name */ |
|
@@ -186,7 +186,7 @@ nutscan_device_t * nutscan_scan_usb() |
|
dev->descriptor.iProduct, |
|
string, sizeof(string)); |
|
if (ret > 0) { |
|
- device_name = strdup(string); |
|
+ device_name = strdup(rtrim(string, ' ')); |
|
} |
|
} |
|
|
|
@@ -196,7 +196,7 @@ nutscan_device_t * nutscan_scan_usb() |
|
dev->descriptor.iManufacturer, |
|
string, sizeof(string)); |
|
if (ret > 0) { |
|
- vendor_name = strdup(string); |
|
+ vendor_name = strdup(rtrim(string, ' ')); |
|
} |
|
} |
|
|
|
-- |
|
1.7.10.2 |
|
|
|
|