From 607aa95de927b5b8e4b212655c71bf21acbba372 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 8 May 2011 15:13:23 +0100
Subject: [PATCH] Fix guestfs___rollback_cmdline when pos == 0.

Because of the previous change to size_t, when pos == 0 the loop would
wrap around and cause a segmentation fault.

This fixes a regression introduced by
commit 10167cea98f93a74abe63f0a54d3a662997e7489.
---
 src/launch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/launch.c b/src/launch.c
index 8dfeb31..ecc0464 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -117,7 +117,7 @@ guestfs___rollback_cmdline (guestfs_h *g, size_t pos)
 
   assert (g->cmdline_size >= pos);
 
-  for (i = g->cmdline_size - 1; i >= pos; --i)
+  for (i = pos; i < g->cmdline_size; ++i)
     free (g->cmdline[i]);
 
   g->cmdline_size = pos;
-- 
1.8.3.1