From: Christian Brauner Date: Thu, 21 Feb 2019 19:28:24 +0000 (+0100) Subject: lxc-attach: switch to attach_run_wait X-Git-Tag: lxc-3.2.0~133^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8cddb10fe12487057f25dca9740942a27bfd4d2d;p=thirdparty%2Flxc.git lxc-attach: switch to attach_run_wait Signed-off-by: Christian Brauner --- 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);