lxc-create: Don't print the help message twice

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>
This commit is contained in:
Stéphane Graber 2014-01-15 22:53:20 -05:00
parent 09ec76ceec
commit 19668d8b07

View 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);