]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lxc-create: Don't print the help message twice
authorStéphane Graber <stgraber@ubuntu.com>
Thu, 16 Jan 2014 03:53:20 +0000 (22:53 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 16 Jan 2014 04:31:23 +0000 (23:31 -0500)
The forking logic was wrong, causing both the child and the parent to
call the template with -h.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_create.c

index 6d94709d1ff85eb2ced339e1910f0e0bb012609b..058dc43bdea80ca33669ec78d373d2f860f4c7d8 100644 (file)
@@ -107,10 +107,13 @@ static void create_helpfn(const struct lxc_arguments *args) {
 
        if (!args->template)
                return;
-       if ((pid = fork()) < 0)
-               return;
-       if (pid)
+
+       pid = fork();
+       if (pid) {
                wait_for_pid(pid);
+               return;
+       }
+
        len = strlen(LXCTEMPLATEDIR) + strlen(args->template) + strlen("/lxc-") + 1;
        path = alloca(len);
        ret = snprintf(path, len,  "%s/lxc-%s", LXCTEMPLATEDIR, args->template);