From: Max Reitz Date: Wed, 12 Oct 2016 20:49:05 +0000 (+0200) Subject: block: Fix bdrv_iterate_format() sorting X-Git-Tag: TizenStudio_2.0_p2.3.2~9^2~14^2~5^2~59^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ceff5bd79cdf94c650902fe9a20d316dcbfa1cc9;p=sdk%2Femulator%2Fqemu.git 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 Message-id: 20161012204907.25941-2-mreitz@redhat.com Reviewed-by: Eric Blake Signed-off-by: Max Reitz --- 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),