Skip to content

Commit

Permalink
lxc-attach: switch to attach_run_wait
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 21, 2019
1 parent b557844 commit 8cddb10
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/lxc/tools/lxc_attach.c
Expand Up @@ -372,19 +372,23 @@ int main(int argc, char *argv[])
if (my_args.gid)
attach_options.gid = my_args.gid;

if (command.program)
ret = c->attach(c, lxc_attach_run_command, &command, &attach_options, &pid);
else
if (command.program) {
ret = c->attach_run_wait(c, &attach_options, command.program,
(const char **)command.argv);
if (ret < 0)
goto out;
} else {
ret = c->attach(c, lxc_attach_run_shell, NULL, &attach_options, &pid);
if (ret < 0)
goto out;
if (ret < 0)
goto out;

ret = lxc_wait_for_pid_status(pid);
if (ret < 0)
goto out;
ret = lxc_wait_for_pid_status(pid);
if (ret < 0)
goto out;

if (WIFEXITED(ret))
wexit = WEXITSTATUS(ret);
if (WIFEXITED(ret))
wexit = WEXITSTATUS(ret);
}

out:
lxc_container_put(c);
Expand Down

0 comments on commit 8cddb10

Please sign in to comment.