提交 81d6c4de 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 a154f5f3
......@@ -2193,11 +2193,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++;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册