kvm_getprocs: gracefully handle errors from kvm_deadprocs

and don't confuse callers with incorrect return value

MFC after:	9 days
This commit is contained in:
Andriy Gapon 2012-10-06 20:16:04 +00:00
parent 9fb9ea1c03
commit ca895af355

View file

@ -593,9 +593,15 @@ liveout:
nprocs = kvm_deadprocs(kd, op, arg, nl[1].n_value,
nl[2].n_value, nprocs);
if (nprocs <= 0) {
_kvm_freeprocs(kd);
nprocs = 0;
}
#ifdef notdef
size = nprocs * sizeof(struct kinfo_proc);
(void)realloc(kd->procbase, size);
else {
size = nprocs * sizeof(struct kinfo_proc);
kd->procbase = realloc(kd->procbase, size);
}
#endif
}
*cnt = nprocs;