OpenSDE Packages Database (without history before r20070)
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

  1. From 0b10420084b93572b1fec091d1ca4948c6cbba62 Mon Sep 17 00:00:00 2001
  2. From: Christian Wiese <christian.wiese@securepoint.de>
  3. Date: Thu, 25 Apr 2013 15:10:00 +0200
  4. Subject: [PATCH] nut-scanner: fix scan_usb to remove trailing spaces from
  5. output strings
  6. This patch uses rtrim() from libcommon to remove trailing spaces from
  7. serialnumber, device_name and vendor_name.
  8. see: https://github.com/networkupstools/nut/issues/26
  9. ---
  10. tools/nut-scanner/Makefile.am | 2 +-
  11. tools/nut-scanner/scan_usb.c | 6 +++---
  12. 2 files changed, 4 insertions(+), 4 deletions(-)
  13. diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am
  14. index d4066d2..87fb6ed 100644
  15. --- a/tools/nut-scanner/Makefile.am
  16. +++ b/tools/nut-scanner/Makefile.am
  17. @@ -17,7 +17,7 @@ libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL
  18. nut_scanner_SOURCES = nut-scanner.c
  19. nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include
  20. -nut_scanner_LDADD = libnutscan.la
  21. +nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la
  22. if WITH_SSL
  23. libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS)
  24. diff --git a/tools/nut-scanner/scan_usb.c b/tools/nut-scanner/scan_usb.c
  25. index d6e1e4e..1a4bb24 100644
  26. --- a/tools/nut-scanner/scan_usb.c
  27. +++ b/tools/nut-scanner/scan_usb.c
  28. @@ -177,7 +177,7 @@ nutscan_device_t * nutscan_scan_usb()
  29. dev->descriptor.iSerialNumber,
  30. string, sizeof(string));
  31. if (ret > 0) {
  32. - serialnumber = strdup(string);
  33. + serialnumber = strdup(rtrim(string, ' '));
  34. }
  35. }
  36. /* get product name */
  37. @@ -186,7 +186,7 @@ nutscan_device_t * nutscan_scan_usb()
  38. dev->descriptor.iProduct,
  39. string, sizeof(string));
  40. if (ret > 0) {
  41. - device_name = strdup(string);
  42. + device_name = strdup(rtrim(string, ' '));
  43. }
  44. }
  45. @@ -196,7 +196,7 @@ nutscan_device_t * nutscan_scan_usb()
  46. dev->descriptor.iManufacturer,
  47. string, sizeof(string));
  48. if (ret > 0) {
  49. - vendor_name = strdup(string);
  50. + vendor_name = strdup(rtrim(string, ' '));
  51. }
  52. }
  53. --
  54. 1.7.10.2