From 3a4a60d1d2303f51ea0ed442aa38cc5a9a4201c5 Mon Sep 17 00:00:00 2001 From: Dmitriy Anisimkov Date: Mon, 8 Jul 2019 08:14:50 +0000 Subject: [PATCH] [Ada] Os_Lib: do not call __gnat_kill for Invalid_Pid 2019-07-08 Dmitriy Anisimkov gcc/ada/ * libgnat/s-os_lib.adb: Do not call __gnat_kill for Invalid_Pid. From-SVN: r273223 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/libgnat/s-os_lib.adb | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d38dce0f9eb..672ac82b9ff 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2019-07-08 Dmitriy Anisimkov + + * libgnat/s-os_lib.adb: Do not call __gnat_kill for Invalid_Pid. + 2019-07-08 Piotr Trojanek * sem_util.adb (Enclosing_Package_Or_Subprogram): Do not expect diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb index 7efddf710c6..c3c1979ec9e 100644 --- a/gcc/ada/libgnat/s-os_lib.adb +++ b/gcc/ada/libgnat/s-os_lib.adb @@ -1629,10 +1629,12 @@ package body System.OS_Lib is pragma Import (C, C_Kill, "__gnat_kill"); begin - if Hard_Kill then - C_Kill (Pid, SIGKILL, 1); - else - C_Kill (Pid, SIGINT, 1); + if Pid /= Invalid_Pid then + if Hard_Kill then + C_Kill (Pid, SIGKILL, 1); + else + C_Kill (Pid, SIGINT, 1); + end if; end if; end Kill; -- 2.30.2