]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-attach: switch to attach_run_wait 2879/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 21 Feb 2019 19:28:24 +0000 (20:28 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 21 Feb 2019 19:28:24 +0000 (20:28 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_attach.c

index d10b6ecc23847d23350bda58bc89859588e87a11..917cca2821dc82f3f4784af64e2dc04a743b0dba 100644 (file)
@@ -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);