From 28e2bceefeedbef82dcc24e60e8a22da0960354a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 16 Jun 2009 09:56:19 +0100 Subject: [PATCH] Fix build_supermin_appliance to return kernel / initrd names. --- src/guestfs.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/guestfs.c b/src/guestfs.c index 8f06d3b..20fafc1 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -1148,17 +1148,26 @@ build_supermin_appliance (guestfs_h *g, const char *path, char **kernel, char **initrd) { char cmd[4096]; - int r; + int r, len; + + len = strlen (g->tmpdir); + *kernel = safe_malloc (g, len + 8); + snprintf (*kernel, len+8, "%s/kernel", g->tmpdir); + *initrd = safe_malloc (g, len + 8); + snprintf (*initrd, len+8, "%s/initrd", g->tmpdir); snprintf (cmd, sizeof cmd, "PATH='%s':$PATH " - "guestfs-supermin-helper '%s' %s/kernel %s/initrd", + "guestfs-supermin-helper '%s' %s %s", path, - path, g->tmpdir, g->tmpdir); + path, *kernel, *initrd); r = system (cmd); if (r == -1 || WEXITSTATUS(r) != 0) { error (g, _("external command failed: %s"), cmd); + free (*kernel); + free (*initrd); + *kernel = *initrd = NULL; return -1; } -- 1.8.3.1