Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Deseyn <tom.deseyn@gmail.com>2022-01-24 13:10:25 +0300
committergithub-actions <github-actions@github.com>2022-02-08 17:49:59 +0300
commitebd62f24faa09b75c15d60da73331cb496cf50a7 (patch)
tree9dd44419659e8d1b15921d4112b9b1468fccacaf
parent53ca85fb900f39a990236ebd6bce0212854a3165 (diff)
Console.Unix: fix missing terminal configuration on SIGINT/SIGQUIT/SIGCONT.backport/pr-64200-to-release/6.0
The introduction of the managed API for signal handling (PosixSignal) inadvertently caused terminal configuration to no longer be performed when no managed handlers are registered. This adds back the unconditional registration for SIGINT/SIGQUIT/SIGCONT. The missing registrations can cause the terminal to stop echoing when an application terminates on Ctrl-C.
-rw-r--r--src/libraries/Native/Unix/System.Native/pal_signal.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libraries/Native/Unix/System.Native/pal_signal.c b/src/libraries/Native/Unix/System.Native/pal_signal.c
index 6e7243fca17..fb962838276 100644
--- a/src/libraries/Native/Unix/System.Native/pal_signal.c
+++ b/src/libraries/Native/Unix/System.Native/pal_signal.c
@@ -584,6 +584,16 @@ int32_t InitializeSignalHandlingCore()
return 0;
}
+#ifdef HAS_CONSOLE_SIGNALS
+ // Unconditionally register signals for terminal configuration.
+ bool installed = InstallSignalHandler(SIGINT, SA_RESTART);
+ assert(installed);
+ installed = InstallSignalHandler(SIGQUIT, SA_RESTART);
+ assert(installed);
+ installed = InstallSignalHandler(SIGCONT, SA_RESTART);
+ assert(installed);
+#endif
+
return 1;
}
@@ -612,7 +622,12 @@ void SystemNative_DisablePosixSignalHandling(int signalCode)
{
g_hasPosixSignalRegistrations[signalCode - 1] = false;
- if (!(g_consoleTtouHandler && signalCode == SIGTTOU) &&
+ // Don't restore handler when something other than posix handling needs the signal.
+ if (
+#ifdef HAS_CONSOLE_SIGNALS
+ signalCode != SIGINT && signalCode != SIGQUIT && signalCode != SIGCONT &&
+#endif
+ !(g_consoleTtouHandler && signalCode == SIGTTOU) &&
!(g_sigChldCallback && signalCode == SIGCHLD) &&
!(g_terminalInvalidationCallback && (signalCode == SIGCONT ||
signalCode == SIGCHLD ||