sh: Fix INTOFF leak when a redirection on a compound command fails.
Reported by: bdrewery
This commit is contained in:
@@ -470,6 +470,7 @@ evalredir(union node *n, int flags)
|
|||||||
if (e == EXERROR || e == EXEXEC) {
|
if (e == EXERROR || e == EXEXEC) {
|
||||||
if (in_redirect) {
|
if (in_redirect) {
|
||||||
exitstatus = 2;
|
exitstatus = 2;
|
||||||
|
FORCEINTON;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ ${PACKAGE}FILES+= redirection-error4.0
|
|||||||
${PACKAGE}FILES+= redirection-error5.0
|
${PACKAGE}FILES+= redirection-error5.0
|
||||||
${PACKAGE}FILES+= redirection-error6.0
|
${PACKAGE}FILES+= redirection-error6.0
|
||||||
${PACKAGE}FILES+= redirection-error7.0
|
${PACKAGE}FILES+= redirection-error7.0
|
||||||
|
${PACKAGE}FILES+= redirection-error8.0
|
||||||
${PACKAGE}FILES+= write-error1.0
|
${PACKAGE}FILES+= write-error1.0
|
||||||
|
|
||||||
.include <bsd.test.mk>
|
.include <bsd.test.mk>
|
||||||
|
|||||||
@@ -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 ]
|
||||||
Reference in New Issue
Block a user