From 3f2da875f7d1a7f4bc2fc9b85c20d3067e8f4f1e Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 7 May 2017 19:49:46 +0000 Subject: [PATCH] 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. MFC after: 1 week --- 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 b3e325507dd5..864c8767d034 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -120,6 +120,7 @@ ${PACKAGE}FILES+= local7.0 .if ${MK_NLS} != "no" ${PACKAGE}FILES+= locale1.0 .endif +${PACKAGE}FILES+= locale2.0 ${PACKAGE}FILES+= printf1.0 ${PACKAGE}FILES+= printf2.0 ${PACKAGE}FILES+= printf3.0 diff --git a/bin/sh/tests/builtins/locale2.0 b/bin/sh/tests/builtins/locale2.0 new file mode 100644 index 000000000000..86dd237ff54a --- /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 491ebe952e6a..f533969a9b0a 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -513,7 +513,7 @@ bltinunsetlocale(void) if (localevar(cmdenviron->args[i])) { setlocale(LC_ALL, ""); updatecharset(); - return; + break; } } INTON;