[Ada] Os_Lib: do not call __gnat_kill for Invalid_Pid
authorDmitriy Anisimkov <anisimko@adacore.com>
Mon, 8 Jul 2019 08:14:50 +0000 (08:14 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 8 Jul 2019 08:14:50 +0000 (08:14 +0000)
2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

* libgnat/s-os_lib.adb: Do not call __gnat_kill for Invalid_Pid.

From-SVN: r273223

gcc/ada/ChangeLog
gcc/ada/libgnat/s-os_lib.adb

index d38dce0f9eb376b876c739bee26a93ed6cdb426b..672ac82b9fff22bcabb7ee64cb830fe55547b691 100644 (file)
@@ -1,3 +1,7 @@
+2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>
+
+       * libgnat/s-os_lib.adb: Do not call __gnat_kill for Invalid_Pid.
+
 2019-07-08  Piotr Trojanek  <trojanek@adacore.com>
 
        * sem_util.adb (Enclosing_Package_Or_Subprogram): Do not expect
index 7efddf710c6de506892b1e7751fab99873b3e36b..c3c1979ec9e6835351d7211d0cca168388447321 100644 (file)
@@ -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;