A small bit of defensive programming in case the panic is during process

exit and cleanup.  the 'ps' command assumes that there are always 'nproc'
processes on the lists and will walk off the end without checking if not,
causing ddb to trap during the 'ps' command.
This commit is contained in:
peter 1996-06-15 07:08:02 +00:00
parent 6e2846f8c9
commit 1c2de87481

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: db_ps.c,v 1.10 1995/12/10 19:08:08 bde Exp $
* $Id: db_ps.c,v 1.11 1996/03/11 05:53:59 hsu Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
@ -84,6 +84,10 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
return;
}
}
if (p == NULL) {
printf("oops, ran out of processes early!\n");
break;
}
pp = p->p_pptr;
if (pp == NULL)
pp = p;