]> Git Repo - qemu.git/commitdiff
block: Fix bdrv_iterate_format() sorting
authorMax Reitz <[email protected]>
Wed, 12 Oct 2016 20:49:05 +0000 (22:49 +0200)
committerMax Reitz <[email protected]>
Fri, 11 Nov 2016 14:56:22 +0000 (15:56 +0100)
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 <[email protected]>
Message-id: 20161012204907[email protected]
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
block.c

diff --git a/block.c b/block.c
index c19c6c6d42cca985e03afd02fced822d802622ac..67c70c10102d3c9ae5e6121af90f1886f62a6277 100644 (file)
--- 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),
This page took 0.030885 seconds and 4 git commands to generate.