From 8cddb10fe12487057f25dca9740942a27bfd4d2d Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 21 Feb 2019 20:28:24 +0100 Subject: [PATCH] lxc-attach: switch to attach_run_wait Signed-off-by: Christian Brauner --- src/lxc/tools/lxc_attach.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c index d10b6ecc2..917cca282 100644 --- a/src/lxc/tools/lxc_attach.c +++ b/src/lxc/tools/lxc_attach.c @@ -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); -- 2.47.2