From bae87dbdd9b2df4f4face3945d390a623f80ae49 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 23 Jun 2015 11:49:11 -0700 Subject: [PATCH] Silence a warning by converting the bitmap to a string prior to printing the error --- orte/mca/rtc/hwloc/rtc_hwloc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/orte/mca/rtc/hwloc/rtc_hwloc.c b/orte/mca/rtc/hwloc/rtc_hwloc.c index 51c9565570..6c127c2e8b 100644 --- a/orte/mca/rtc/hwloc/rtc_hwloc.c +++ b/orte/mca/rtc/hwloc/rtc_hwloc.c @@ -105,14 +105,16 @@ static void set(orte_job_t *jobdat, rc = hwloc_set_cpubind(opal_hwloc_topology, sum->available, 0); /* if we got an error and this wasn't a default binding policy, then report it */ if (rc < 0 && OPAL_BINDING_POLICY_IS_SET(jobdat->map->binding)) { - char *tmp = NULL; if (errno == ENOSYS) { msg = "hwloc indicates cpu binding not supported"; } else if (errno == EXDEV) { msg = "hwloc indicates cpu binding cannot be enforced"; } else { + char *tmp; + (void)hwloc_bitmap_list_asprintf(&tmp, sum->available); asprintf(&msg, "hwloc_set_cpubind returned \"%s\" for bitmap \"%s\"", - opal_strerror(rc), sum->available); + opal_strerror(rc), tmp); + free(tmp); } if (OPAL_BINDING_REQUIRED(jobdat->map->binding)) { /* If binding is required, send an error up the pipe (which exits @@ -126,16 +128,8 @@ static void set(orte_job_t *jobdat, "help-orte-odls-default.txt", "not bound", orte_process_info.nodename, context->app, msg, __FILE__, __LINE__); - if (NULL != tmp) { - free(tmp); - free(msg); - } return; } - if (NULL != tmp) { - free(tmp); - free(msg); - } } } if (0 == rc && opal_hwloc_report_bindings) {