File multipath-tools-strip-trailing-blanks-from-wwid of Package multipath-tools

From 4e00843623f3d3f3f1b1a2f20e0bc8cf873e466f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 4 Mar 2009 13:37:43 +0100
Subject: [PATCH] Strip trailing blanks from wwid

We should be stripping any trailing blanks from the wwid to catch
invalid wwid with just blanks.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/discovery.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index c72d204..eebfbd5 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -870,6 +870,7 @@ static int
 get_uid (struct path * pp)
 {
 	char buff[CALLOUT_MAX_SIZE];
+	int i;
 
 	if (!pp->getuid)
 		select_getuid(pp);
@@ -882,6 +883,12 @@ get_uid (struct path * pp)
 		memset(pp->wwid, 0, WWID_SIZE);
 		return 1;
 	}
+	/* Strip any trailing blanks */
+	i = WWID_SIZE - 1;
+	while (i > 0 && pp->wwid[i] == ' ') {
+		pp->wwid[i] = '\0';
+		i--;
+	}
 	condlog(3, "%s: uid = %s (callout)", pp->dev ,pp->wwid);
 	return 0;
 }
-- 
1.6.0.2

openSUSE Build Service is sponsored by