mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-15 17:15:18 +00:00
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 <berrange@redhat.com> (cherry picked from commit 81d6c4defe2b72f34b02884bb78f924165998771)
This commit is contained in:
parent
179216680e
commit
f45dded083
@ -2157,11 +2157,10 @@ int virDiskNameToIndex(const char *name) {
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; *ptr; i++) {
|
for (i = 0; *ptr; i++) {
|
||||||
idx = (idx + (i < 1 ? 0 : 1)) * 26;
|
|
||||||
|
|
||||||
if (!c_islower(*ptr))
|
if (!c_islower(*ptr))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
idx = (idx + (i < 1 ? 0 : 1)) * 26;
|
||||||
idx += *ptr - 'a';
|
idx += *ptr - 'a';
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user