ash: eval: Only restore exit status on exit/return
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 20 Feb 2020 15:54:29 +0000 (16:54 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 20 Feb 2020 15:54:29 +0000 (16:54 +0100)
commitf977e004cefe46e8010c3d29681d77da50e380a9
tree39c1afc6b44350bd56fe03ed59afb8f4bfae645e
parentcd24a506336f84ff2bb3318bc4f2f82dd025f318
ash: eval: Only restore exit status on exit/return

Upstream commit:

    Date: Fri, 14 Dec 2018 13:52:02 +0800
    eval: Only restore exit status on exit/return

    We unconditionally restore the saved status in exitreset, which
    is incorrect as we only want to do it for exitcmd and returncmd.
    This patch fixes the problem by introducing EXEND.

Reported-by: Martijn Dekker <martijn@inlv.org>
    Fixes: da30b4b78769 ("[BUILTIN] Exit without arguments in a trap...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c