]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-attach: make sure exit status of command is returned
authorAntonio Terceiro <terceiro@debian.org>
Sun, 18 Aug 2019 20:30:32 +0000 (17:30 -0300)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 2 Dec 2019 12:59:19 +0000 (13:59 +0100)
Commit ae68cad763d5b39a6a9e51de2acd1ad128b720ca introduced a regression that
makes lxc-attach ignore the exit status of the executed command. This was first
identified in 3.0.4 LTS, while it worked on 3.0.3.

  # lxc-attach --version
  3.0.4
  # lxc-attach -n test false; echo $?
  0

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=934983

src/lxc/tools/lxc_attach.c

index e2a5b307a8a97f143f4356162120aa7ee8fd3816..a9334b936ad57f4c25fa758ed7f8b531c74cf6be 100644 (file)
@@ -367,10 +367,9 @@ int main(int argc, char *argv[])
                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);