sh: Fix INTOFF leak when a redirection on a compound command fails.
Reported by: bdrewery
This commit is contained in:
parent
51d93426d9
commit
eab4998278
@ -470,6 +470,7 @@ evalredir(union node *n, int flags)
|
||||
if (e == EXERROR || e == EXEXEC) {
|
||||
if (in_redirect) {
|
||||
exitstatus = 2;
|
||||
FORCEINTON;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ ${PACKAGE}FILES+= redirection-error4.0
|
||||
${PACKAGE}FILES+= redirection-error5.0
|
||||
${PACKAGE}FILES+= redirection-error6.0
|
||||
${PACKAGE}FILES+= redirection-error7.0
|
||||
${PACKAGE}FILES+= redirection-error8.0
|
||||
${PACKAGE}FILES+= write-error1.0
|
||||
|
||||
.include <bsd.test.mk>
|
||||
|
5
bin/sh/tests/errors/redirection-error8.0
Normal file
5
bin/sh/tests/errors/redirection-error8.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
$SH -c '{ { :; } </var/empty/x; } 2>/dev/null || kill -INT $$; echo continued'
|
||||
r=$?
|
||||
[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ]
|
Loading…
x
Reference in New Issue
Block a user