[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 08/12] block: Fix bdrv_iterate_format() sorting

From: Kevin Wolf
Subject: [Qemu-devel] [PULL 08/12] block: Fix bdrv_iterate_format() sorting
Date: Fri, 11 Nov 2016 17:55:07 +0100

From: Max Reitz <address@hidden>

bdrv_iterate_format() did not actually sort the formats by name but by
"pointer interpreted as string". That is probably not what we intended
to do, so fix it (by changing qsort_strcmp() so it matches the example
from qsort()'s manual page).

Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block.c b/block.c
index c19c6c6..67c70c1 100644
--- a/block.c
+++ b/block.c
@@ -2796,7 +2796,7 @@ const char *bdrv_get_format_name(BlockDriverState *bs)
 static int qsort_strcmp(const void *a, const void *b)
-    return strcmp(a, b);
+    return strcmp(*(char *const *)a, *(char *const *)b);
 void bdrv_iterate_format(void (*it)(void *opaque, const char *name),

reply via email to

[Prev in Thread] Current Thread [Next in Thread]