about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-04 01:23:21 +0000
committerRoland McGrath <roland@gnu.org>1996-01-04 01:23:21 +0000
commit67f27f3a02d623331a56cddee2a56c34b3b13bd9 (patch)
tree973679146bef0021c00936ec25c43bb7165f357a
parent9418ccede9a13454725442ab7f3cf47b3302bf6f (diff)
downloadglibc-67f27f3a02d623331a56cddee2a56c34b3b13bd9.tar.gz
glibc-67f27f3a02d623331a56cddee2a56c34b3b13bd9.tar.xz
glibc-67f27f3a02d623331a56cddee2a56c34b3b13bd9.zip
(_hurd_sig_post): When doing pgrp, make sure we do ourselves last.
-rw-r--r--hurd/hurdkill.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/hurd/hurdkill.c b/hurd/hurdkill.c
index 364b6ed692..a8f101d768 100644
--- a/hurd/hurdkill.c
+++ b/hurd/hurdkill.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -58,16 +58,25 @@ _hurd_sig_post (pid_t pid, int sig, mach_port_t arg_refport)
       err = __proc_getpgrppids (proc, - pid, &pids, &npids);
       if (!err)
 	{
+	  int self = 0;
 	  for (i = 0; i < npids; ++i)
-	    {
-	      kill_pid (pids[i]);
-	      if (err == ESRCH)
-		/* The process died already.  Ignore it.  */
-		err = 0;
-	    }
+	    if (pids[i] == _hurd_pid)
+	      /* We must do ourselves last so we are not suspended
+		 and fail to suspend the other processes in the pgrp.  */
+	      self = 1;
+	    else
+	      {
+		kill_pid (pids[i]);
+		if (err == ESRCH)
+		  /* The process died already.  Ignore it.  */
+		  err = 0;
+	      }
 	  if (pids != pidsbuf)
 	    __vm_deallocate (__mach_task_self (),
 			     (vm_address_t) pids, npids * sizeof (pids[0]));
+
+	  if (self)
+	    kill_pid (_hurd_pid);
 	}
     }
   else