From dacefa3cb28a74c6d7b033a1877311b599e7520e Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 15 Apr 2001 08:10:51 +0000 Subject: 2000-04-03 Neal H Walfield * host.c (S_proc_setexecdata): Check for memory allocation errors. Use memcpy, not bcopy. (S_proc_getexecdata): Likewise. (S_proc_execdata_notify): Check return of malloc. (S_proc_register_version): Likewise. (initialize_version_info): Add asserts. * info.c (S_proc_pid2task): Do not bother searching for the pid if we do not have a valid caller. (S_proc_pid2proc): Likewise. Use memcpy, not bcopy. (S_proc_getprocinfo): Doc fixes. Use MAP_FAILED not -1. Use memcpy, not bcopy. (S_proc_getloginpids): Check return value of malloc. Use realloc correctly. (S_proc_setlogin): Check return value of malloc. * main.c (main): Assert allocate_proc. * mgt.c (make_ids): Check return value of malloc and fail accordingly. (S_proc_reauthenticate): Check return value of make_ids and fail accordingly. (S_proc_child): Call task_find after we know that we were passed a valid child. (S_proc_reassign): Likewise. (S_proc_handle_exceptions): Use memcpy, not bcopy. (allocate_proc): Check return value of ports_create_port and fail accordingly. (create_startup_proc): Add asserts. (complete_proc): Do not assume the length of "". * msg.c (S_proc_getmsgport): Call pid_find_allow_zombie after we know we were passed a valid caller. * pgrp.c: Include assert.h. (new_pgrp): Check return value of malloc and fail accordingly. (new_session): Likewise. (boot_setsid): Assert sess. (S_proc_getsessionpids): Use MAP_FAILED not -1. (S_proc_getsessionppids): Likewise. (S_proc_getpgrppids): Likewise. * wait.c (S_proc_wait): Use memset, not bzero. --- proc/main.c | 8 +++++--- proc/msg.c | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/proc/main.c b/proc/main.c index aa1c0c30..f2cdfdf5 100644 --- a/proc/main.c +++ b/proc/main.c @@ -1,5 +1,5 @@ /* Initialization of the proc server - Copyright (C) 1993,94,95,96,97,99,2000 Free Software Foundation, Inc. + Copyright (C) 1993,94,95,96,97,99,2000,01 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -85,6 +85,8 @@ main (int argc, char **argv, char **envp) /* Create our own proc object (we are PID 0). */ self_proc = allocate_proc (mach_task_self ()); + assert (self_proc); + complete_proc (self_proc, 0); startup_port = ports_get_send_right (startup_proc); @@ -101,8 +103,8 @@ main (int argc, char **argv, char **envp) add_proc_to_hash (startup_proc); /* Now that we have the task port. */ /* Set our own argv and envp locations. */ - self_proc->p_argv = (int) argv; - self_proc->p_envp = (int) envp; + self_proc->p_argv = (vm_address_t) argv; + self_proc->p_envp = (vm_address_t) envp; /* Give ourselves good scheduling performance, because we are so important. */ diff --git a/proc/msg.c b/proc/msg.c index b8413e3b..ff1dbc54 100644 --- a/proc/msg.c +++ b/proc/msg.c @@ -1,5 +1,5 @@ /* Message port manipulations - Copyright (C) 1994, 1995, 1996, 1999 Free Software Foundation + Copyright (C) 1994, 1995, 1996, 1999, 2001 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -116,11 +116,13 @@ S_proc_getmsgport (struct proc *callerp, mach_port_t *msgport) { int cancel; - struct proc *p = pid_find_allow_zombie (pid); + struct proc *p; if (!callerp) return EOPNOTSUPP; + p = pid_find_allow_zombie (pid); + restart: while (p && p->p_deadmsg && !p->p_dead) { -- cgit v1.2.3