aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDmitriy Anisimkov <anisimko@adacore.com>2021-12-20 17:44:58 +0600
committerPierre-Marie de Rodat <derodat@adacore.com>2022-01-07 16:24:11 +0000
commit20f6d5e4a8862f733e66f57ac9f2f2792903ac61 (patch)
tree90caac721b0f934aba2099ce835c99b90438fd04 /gcc
parent13e04137665e2e7cab689c280eab7875e4318e0d (diff)
downloadgcc-20f6d5e4a8862f733e66f57ac9f2f2792903ac61.zip
gcc-20f6d5e4a8862f733e66f57ac9f2f2792903ac61.tar.gz
gcc-20f6d5e4a8862f733e66f57ac9f2f2792903ac61.tar.bz2
[Ada] Fix __gnat_kill on Windows
gcc/ada/ * adaint.c (__gnat_kill): Terminate process only in case of SIGKILL, SIGINT, SIGBREAK, SIGTERM, SIGABRT. Do not call OpenProcess if not going to terminate process.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/adaint.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 2db3528..68f187b 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3559,13 +3559,21 @@ void
__gnat_kill (int pid, int sig, int close ATTRIBUTE_UNUSED)
{
#if defined(_WIN32)
- HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
- if (h == NULL)
- return;
+ HANDLE h;
- TerminateProcess (h, sig);
+ switch (sig) {
+ case 9: // SIGKILL is not declared in Windows headers
+ case SIGINT:
+ case SIGBREAK:
+ case SIGTERM:
+ case SIGABRT:
+ h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
+ if (h != NULL) {
+ TerminateProcess (h, sig);
+ CloseHandle (h);
+ }
+ }
- CloseHandle (h);
#elif defined (__vxworks)
/* Not implemented */
#else