summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorMax Reitz2016-10-12 22:49:05 +0200
committerMax Reitz2016-11-11 15:56:22 +0100
commitceff5bd79cdf94c650902fe9a20d316dcbfa1cc9 (patch)
treebb750c7055041340987302406f303d2779d07492 /block.c
parentnfs: Fix memory leak in nfs_file_create() (diff)
downloadqemu-ceff5bd79cdf94c650902fe9a20d316dcbfa1cc9.tar.gz
qemu-ceff5bd79cdf94c650902fe9a20d316dcbfa1cc9.tar.xz
qemu-ceff5bd79cdf94c650902fe9a20d316dcbfa1cc9.zip
block: Fix bdrv_iterate_format() sorting
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 <mreitz@redhat.com> Message-id: 20161012204907.25941-2-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block.c b/block.c
index c19c6c6d42..67c70c1010 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),