summaryrefslogtreecommitdiffstats
path: root/sys/ddb/db_ps.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-06-15 07:08:02 +0000
committerpeter <peter@FreeBSD.org>1996-06-15 07:08:02 +0000
commitf420d94a194ef9f4bea9befa8aed4171e76313b1 (patch)
tree54c871b5498834c0fe38c93eabc862625f18107f /sys/ddb/db_ps.c
parent595f5f5875d95682ec6496834a0c25659479a883 (diff)
downloadFreeBSD-src-f420d94a194ef9f4bea9befa8aed4171e76313b1.zip
FreeBSD-src-f420d94a194ef9f4bea9befa8aed4171e76313b1.tar.gz
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.
Diffstat (limited to 'sys/ddb/db_ps.c')
-rw-r--r--sys/ddb/db_ps.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 780d4e6..c2b03aa 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -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;
OpenPOWER on IntegriCloud