svn commit: r241632 - stable/9/lib/libkvm
Andriy Gapon
avg at FreeBSD.org
Wed Oct 17 11:26:28 UTC 2012
Author: avg
Date: Wed Oct 17 11:26:27 2012
New Revision: 241632
URL: http://svn.freebsd.org/changeset/base/241632
Log:
MFC r241303: kvm_getprocs: gracefully handle errors from kvm_deadprocs
Modified:
stable/9/lib/libkvm/kvm_proc.c
Directory Properties:
stable/9/lib/libkvm/ (props changed)
Modified: stable/9/lib/libkvm/kvm_proc.c
==============================================================================
--- stable/9/lib/libkvm/kvm_proc.c Wed Oct 17 11:24:19 2012 (r241631)
+++ stable/9/lib/libkvm/kvm_proc.c Wed Oct 17 11:26:27 2012 (r241632)
@@ -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;
More information about the svn-src-stable-9
mailing list