From f45dded083c4a2b63311831ce0ec075e7a287a76 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 22 Nov 2012 14:56:08 +0000 Subject: [PATCH] Fix virDiskNameToIndex to actually ignore partition numbers The docs for virDiskNameToIndex claim it ignores partition numbers. In actual fact though, a code ordering bug means that a partition number will cause the code to accidentally multiply the result by 26. Signed-off-by: Daniel P. Berrange (cherry picked from commit 81d6c4defe2b72f34b02884bb78f924165998771) --- src/util/util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util/util.c b/src/util/util.c index 28f9ae3365..8315515293 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -2157,11 +2157,10 @@ int virDiskNameToIndex(const char *name) { return -1; for (i = 0; *ptr; i++) { - idx = (idx + (i < 1 ? 0 : 1)) * 26; - if (!c_islower(*ptr)) break; + idx = (idx + (i < 1 ? 0 : 1)) * 26; idx += *ptr - 'a'; ptr++; }