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

[Xen-changelog] [qemu-xen master] block: Fix bdrv_iterate_format() sorting



commit ceff5bd79cdf94c650902fe9a20d316dcbfa1cc9
Author:     Max Reitz <mreitz@xxxxxxxxxx>
AuthorDate: Wed Oct 12 22:49:05 2016 +0200
Commit:     Max Reitz <mreitz@xxxxxxxxxx>
CommitDate: Fri Nov 11 15:56:22 2016 +0100

    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@xxxxxxxxxx>
    Message-id: 20161012204907.25941-2-mreitz@xxxxxxxxxx
    Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
    Signed-off-by: Max Reitz <mreitz@xxxxxxxxxx>
---
 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),
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.