diff options
author | Miles Bader <miles@gnu.org> | 1997-02-04 03:10:27 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-02-04 03:10:27 +0000 |
commit | 4efddaf95436c6a00d5715103717d1a2f5ee6b69 (patch) | |
tree | 6d54c6d0ec213c22993fa7071b58d279b9e91d81 /proc | |
parent | bd7a5add0c584ad4c8dea7861cba81ddc8ea79b0 (diff) |
(pid_find, task_find, task_find_nocreate, reqport_find):
Don't dereference P if it's 0.
Diffstat (limited to 'proc')
-rw-r--r-- | proc/hash.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/proc/hash.c b/proc/hash.c index 85eb7c5d..76c2369c 100644 --- a/proc/hash.c +++ b/proc/hash.c @@ -1,5 +1,5 @@ /* Hash table functions - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation + Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation This file is part of the GNU Hurd. @@ -37,7 +37,7 @@ pid_find (pid_t pid) { struct proc *p; p = ihash_find (&pidhash, pid); - return p->p_dead ? 0 : p; + return (!p || p->p_dead) ? 0 : p; } /* Find the process corresponding to a given pid. Return it even if @@ -54,7 +54,7 @@ task_find (task_t task) { struct proc *p; p = ihash_find (&taskhash, task) ? : add_tasks (task); - return p->p_dead ? 0 : p; + return (!p || p->p_dead) ? 0 : p; } /* Find the process corresponding to a given task, but @@ -64,7 +64,7 @@ task_find_nocreate (task_t task) { struct proc *p; p = ihash_find (&taskhash, task); - return p->p_dead ? 0 : p; + return (!p || p->p_dead) ? 0 : p; } /* Find the process corresponding to a given request port. */ @@ -75,7 +75,7 @@ reqport_find (mach_port_t reqport) p = ports_lookup_port (proc_bucket, reqport, proc_class); if (p && p->p_dead) ports_port_deref (p); - return p->p_dead ? 0 : p; + return (!p || p->p_dead) ? 0 : p; } /* Find the process group corresponding to a given pgid. */ |