device-mapper-multipath/0124-libmultipath-cleanup-code-to-strip-wwid-trailing-spa.patch
Benjamin Marzinski b05147c356 device-mapper-multipath-0.8.5-6
Change patch format to remove Git version
  * Patches 0001-0122 only have the patch format modified
Update to the head of the upstream staging branch plus redhat patches
  * Patches 0123-0134 & 1036-0142 are from the upstream staging branch
  * Patches 0143-1046 have been submitted upstream
  * Patch 0156 is a Red Hat only patch. Red Hat udev rules set ID_SERIAL
    from 60-persistent-storage.rules instead of 55-scsi-sg3_id.rules.
    Multipath's parse_vpd_pg83() function needs to match the ID_SERIAL
    value from udev.
Rename files
  * Previous patches 0123-0132 are now patches 1035 & 0147-0155
2021-03-26 13:33:56 -05:00

45 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 24 Feb 2021 00:33:20 -0600
Subject: [PATCH] libmultipath: cleanup code to strip wwid trailing spaces
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 9be94cd1..3a06f319 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2152,11 +2152,11 @@ int
get_uid (struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback)
{
- char *c;
const char *origin = "unknown";
ssize_t len = 0;
struct config *conf;
int used_fallback = 0;
+ size_t i;
if (!pp->uid_attribute && !pp->getuid) {
conf = get_multipath_config();
@@ -2210,12 +2210,9 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev,
return 1;
} else {
/* Strip any trailing blanks */
- c = strchr(pp->wwid, '\0');
- c--;
- while (c && c >= pp->wwid && *c == ' ') {
- *c = '\0';
- c--;
- }
+ for (i = strlen(pp->wwid); i > 0 && pp->wwid[i-1] == ' '; i--);
+ /* no-op */
+ pp->wwid[i] = '\0';
}
condlog((used_fallback)? 1 : 3, "%s: uid = %s (%s)", pp->dev,
*pp->wwid == '\0' ? "<empty>" : pp->wwid, origin);