From 6941420efeefc48100a545806271af2de92dda26 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Apr 2009 13:17:32 +0100 Subject: [PATCH] Fix parsing of paths with more than one element. --- src/guestfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/guestfs.c b/src/guestfs.c index 84da8d6..aa0aadb 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -508,7 +508,7 @@ int guestfs_launch (guestfs_h *g) { static const char *dir_template = "/tmp/libguestfsXXXXXX"; - int r, i, len; + int r, i, len, pmore; int wfd[2], rfd[2]; int tries; const char *kernel_name = "vmlinuz." REPO "." host_cpu; @@ -533,6 +533,7 @@ guestfs_launch (guestfs_h *g) pelem = path = safe_strdup (g, g->path); do { pend = strchrnul (pelem, ':'); + pmore = *pend == ':'; *pend = '\0'; len = pend - pelem; @@ -564,8 +565,8 @@ guestfs_launch (guestfs_h *g) kernel = initrd = NULL; } - pelem = pend; - } while (*pelem++ != '\0'); + pelem = pend + 1; + } while (pmore); free (path); -- 1.8.3.1