From: Richard Jones Date: Sat, 4 Apr 2009 12:17:32 +0000 (+0100) Subject: Fix parsing of paths with more than one element. X-Git-Tag: 0.4~14 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=6941420efeefc48100a545806271af2de92dda26;p=libguestfs.git Fix parsing of paths with more than one element. --- 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);