From: Dmitriy Anisimkov Date: Mon, 20 Dec 2021 11:44:58 +0000 (+0600) Subject: [Ada] Fix __gnat_kill on Windows X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20f6d5e4a8862f733e66f57ac9f2f2792903ac61;p=test_jj.git [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. --- 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