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