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

Re: [libvirt] [PATCH 1/2] snapshot: sort snapshot-list --tree



On Fri, Oct 07, 2011 at 04:35:28PM -0600, Eric Blake wrote:
> Otherwise, the results are not repeatable.
> 
> * tools/virsh.c (cmdSnapshotList): Print tree in predictable order.
> ---
>  tools/virsh.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 9532bc3..20b3dc5 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -13209,6 +13209,8 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
>      if (actual < 0)
>          goto cleanup;
> 
> +    qsort(&names[0], actual, sizeof(char*), namesorter);
> +
>      if (tree) {
>          char indentBuf[INDENT_BUFLEN];
>          char **parents = vshMalloc(ctl, sizeof(char *) * actual);
> @@ -13245,8 +13247,6 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd)
>          ret = true;
>          goto cleanup;
>      } else {
> -        qsort(&names[0], actual, sizeof(char*), namesorter);
> -
>          for (i = 0; i < actual; i++) {
>              /* free up memory from previous iterations of the loop */
>              VIR_FREE(parent);

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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