Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Oct 2012 11:26:28 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241632 - stable/9/lib/libkvm
Message-ID:  <201210171126.q9HBQSwd059495@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210171126.q9HBQSwd059495>