mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
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:
parent
9fb9ea1c03
commit
ca895af355
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241303
|
@ -593,9 +593,15 @@ kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt)
|
|||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue