From 0ff11f75235e5d5ab2bd6d605b0f19032bf2963c Mon Sep 17 00:00:00 2001 From: Terry Dontje Date: Wed, 30 Jul 2008 10:29:05 +0000 Subject: [PATCH] Added initialization and proper increment of the value of num_processors pointer. This commit fixes trac:1420. This commit was SVN r19089. The following Trac tickets were found above: Ticket 1420 --> https://svn.open-mpi.org/trac/ompi/ticket/1420 --- opal/mca/paffinity/solaris/paffinity_solaris_module.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opal/mca/paffinity/solaris/paffinity_solaris_module.c b/opal/mca/paffinity/solaris/paffinity_solaris_module.c index a6bd9f6094..c9c3090f1b 100644 --- a/opal/mca/paffinity/solaris/paffinity_solaris_module.c +++ b/opal/mca/paffinity/solaris/paffinity_solaris_module.c @@ -184,6 +184,9 @@ static int solaris_module_get_processor_info(int *num_processors, int *max_proce * an inclusive list. e.g. If cpuid_max=31, cpuid would be 0-31 */ cpuid_max = sysconf(_SC_CPUID_MAX); + /* clear out num_processors to make sure we get the correct count */ + *num_processors = 0; + /* Because not all CPU ID in cpuid_max are actually valid, * and CPU ID may also not be contiguous. Therefore we * need to run through processor_info to ensure the validity. @@ -191,7 +194,7 @@ static int solaris_module_get_processor_info(int *num_processors, int *max_proce for (currid=0; currid<=cpuid_max; currid++) { if (0 == processor_info(currid, &pinfo)) { if (P_ONLINE == pinfo.pi_state || P_NOINTR == pinfo.pi_state) { - *num_processors++; + (*num_processors)++; *max_processor_id = currid; } }