From 5b3603495a3b4f6721f66a3115391412e750847c Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 29 Mar 1995 21:20:53 +0000 Subject: Don't get barf on processes with zero threads. --- libps/procstat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libps/procstat.c') diff --git a/libps/procstat.c b/libps/procstat.c index 4cb77473..7b5c2fd5 100644 --- a/libps/procstat.c +++ b/libps/procstat.c @@ -186,10 +186,12 @@ proc_stat_set_flags(proc_stat_t ps, int flags) tbi->system_time.microseconds += bi->system_time.microseconds; } - tsi->base_priority /= pi->nthreads; - tsi->cur_priority /= pi->nthreads; - - tbi->sleep_time /= pi->nthreads; + if (pi->nthreads > 0) + { + tsi->base_priority /= pi->nthreads; + tsi->cur_priority /= pi->nthreads; + tbi->sleep_time /= pi->nthreads; + } tbi->user_time.seconds += tbi->user_time.microseconds / 1000000; tbi->user_time.microseconds %= 1000000; -- cgit v1.2.3