From: Richard W.M. Jones Date: Wed, 19 Oct 2011 14:43:37 +0000 (+0100) Subject: inspection: Return root devices sorted. X-Git-Tag: 1.13.22~2 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=c46bedf925cd9c6c9a9cbaee115358fd1dffcbfe;p=libguestfs.git inspection: Return root devices sorted. --- diff --git a/src/inspect.c b/src/inspect.c index 91b84cb..67eb65f 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -123,6 +123,15 @@ guestfs__inspect_os (guestfs_h *g) return ret; } +static int +compare_strings (const void *vp1, const void *vp2) +{ + const char *s1 = * (char * const *) vp1; + const char *s2 = * (char * const *) vp2; + + return strcmp (s1, s2); +} + char ** guestfs__inspect_get_roots (guestfs_h *g) { @@ -151,6 +160,8 @@ guestfs__inspect_get_roots (guestfs_h *g) } ret[count] = NULL; + qsort (ret, count, sizeof (char *), compare_strings); + return ret; }