From d1bf2d7f0f4a83eba7bf42d447e09663b3e38732 Mon Sep 17 00:00:00 2001 From: jilles Date: Sat, 1 Jul 2017 12:57:00 +0000 Subject: [PATCH] MFC r317912: sh: Fix INTOFF leak after a builtin with different locale settings. After executing a builtin with different locale settings such as LC_ALL=C true SIGINT handling was left disabled indefinitely. git-svn-id: svn://svn.freebsd.org/base/stable/10@320531 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- bin/sh/tests/builtins/Makefile | 1 + bin/sh/tests/builtins/locale2.0 | 5 +++++ bin/sh/var.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 bin/sh/tests/builtins/locale2.0 diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index 78b0b0ce3..3f991c5b0 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -100,6 +100,7 @@ FILES+= local4.0 .if ${MK_NLS} != "no" FILES+= locale1.0 .endif +FILES+= locale2.0 FILES+= printf1.0 FILES+= printf2.0 FILES+= printf3.0 diff --git a/bin/sh/tests/builtins/locale2.0 b/bin/sh/tests/builtins/locale2.0 new file mode 100644 index 000000000..86dd237ff --- /dev/null +++ b/bin/sh/tests/builtins/locale2.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +$SH -c 'LC_ALL=C true; kill -INT $$; echo continued' +r=$? +[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ] diff --git a/bin/sh/var.c b/bin/sh/var.c index d083523a0..c603f31b2 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -506,7 +506,7 @@ bltinunsetlocale(void) if (localevar(lp->text)) { setlocale(LC_ALL, ""); updatecharset(); - return; + break; } } INTON; -- 2.42.0