ash: fix error code regression
authorRon Yorston <rmy@pobox.com>
Tue, 3 Jan 2017 10:18:23 +0000 (11:18 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 10 Jan 2017 15:55:51 +0000 (16:55 +0100)
commit568cabf98a11e2e594243a309a9ffd7729a2b213
tree786f2620a7217e3c7238df0fe39b9be351d42ef1
parente94d2c5f242c793db1d76a4c0a63740de8ae6899
ash: fix error code regression

The commit 'ash,hush: set exit code 127 in "sh /does/not/exist" case'
only partly implemented the dash commit '[ERROR] Allow the originator
of EXERROR to set the exit status'.  This resulted in incorrect error
codes for a syntax error:

   $ )
   $ echo $?
   0

or a redirection error for a special builtin:

   $ rm -f xxx
   $ eval cat <xxx
   $ echo $?
   0

Signed-off-by: Ron Yorston <rmy@pobox.com>
Reported-by: Martijn Dekker <martijn@inlv.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/ash_test/ash-misc/exitcode2.right [new file with mode: 0644]
shell/ash_test/ash-misc/exitcode2.tests [new file with mode: 0755]
shell/hush_test/hush-misc/exitcode2.right [new file with mode: 0644]
shell/hush_test/hush-misc/exitcode2.tests [new file with mode: 0755]