diff options
author | Miles Bader <miles@gnu.org> | 1996-07-20 14:13:55 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-07-20 14:13:55 +0000 |
commit | 444cff0b5ef810fbafe3e5a4e7ff5e3e455ace5e (patch) | |
tree | 7f3434ddad4b4e2f11e7f87a5c9b74c0f39a64fe /proc | |
parent | de014a955f2cb75d95ca933773107298e9f5092a (diff) |
(S_proc_getmsgport): Deal with PID dying while we're waiting.
Diffstat (limited to 'proc')
-rw-r--r-- | proc/msg.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -96,16 +96,13 @@ S_proc_getmsgport (struct proc *callerp, pid_t pid, mach_port_t *msgport) { - struct proc *p = pid_find_allow_zombie (pid); int cancel; + struct proc *p = pid_find_allow_zombie (pid); if (!callerp) return EOPNOTSUPP; - - if (!p) - return ESRCH; - while (p->p_deadmsg) + while (p && p->p_deadmsg && !p->p_dead) { callerp->p_msgportwait = 1; p->p_checkmsghangs = 1; @@ -114,8 +111,14 @@ S_proc_getmsgport (struct proc *callerp, return EOPNOTSUPP; if (cancel) return EINTR; + + /* Refetch P in case it went away while we were waiting. */ + p = pid_find_allow_zombie (pid); } + if (!p) + return ESRCH; + *msgport = p->p_msgport; return 0; } |