Skip to content

Commit 105fb15

Browse files
author
Ralph Castain
committed
Silence Coverity warnings
Signed-off-by: Ralph Castain <[email protected]>
1 parent b9f5cab commit 105fb15

File tree

3 files changed

+51
-34
lines changed

3 files changed

+51
-34
lines changed

orte/mca/odls/base/odls_base_default_fns.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata)
633633
orte_proc_t *child = cd->child;
634634
char **env = NULL, **argv = NULL, *cmd = NULL;
635635
int rc, i;
636+
bool found;
636637

637638
/* thread-protect common values */
638639
env = opal_argv_copy(app->env);
@@ -667,6 +668,7 @@ void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata)
667668
opal_list_item_t *nmitem;
668669
orte_namelist_t *nm;
669670
/* see if this rank is one of those requested */
671+
found = false;
670672
for (nmitem = opal_list_get_first(&orte_odls_globals.xterm_ranks);
671673
nmitem != opal_list_get_end(&orte_odls_globals.xterm_ranks);
672674
nmitem = opal_list_get_next(nmitem)) {
@@ -685,6 +687,7 @@ void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata)
685687
}
686688
/* use the xterm cmd as the app string */
687689
cmd = strdup(orte_odls_globals.xtermcmd[0]);
690+
found = true;
688691
break;
689692
} else if (jobdat->num_procs <= nm->name.vpid) { /* check for bozo case */
690693
/* can't be done! */
@@ -695,6 +698,10 @@ void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata)
695698
goto errorout;
696699
}
697700
}
701+
if (!found) {
702+
cmd = strdup(app->app);
703+
argv = opal_argv_copy(app->argv);
704+
}
698705
} else if (NULL != orte_fork_agent) {
699706
/* we were given a fork agent - use it */
700707
argv = opal_argv_copy(orte_fork_agent);
@@ -794,7 +801,6 @@ void orte_odls_base_default_launch_local(int fd, short sd, void *cbdata)
794801
orte_proc_t *child=NULL;
795802
int rc=ORTE_SUCCESS;
796803
char basedir[MAXPATHLEN];
797-
char **argvsav=NULL;
798804
int j, idx;
799805
int total_num_local_procs = 0;
800806
orte_odls_launch_local_t *caddy = (orte_odls_launch_local_t*)cbdata;
@@ -881,15 +887,19 @@ void orte_odls_base_default_launch_local(int fd, short sd, void *cbdata)
881887
if (opal_sys_limits.num_files < limit) {
882888
if (2 < caddy->retries) {
883889
/* tried enough - give up */
884-
child->exit_code = ORTE_PROC_STATE_FAILED_TO_LAUNCH;
885-
ORTE_ACTIVATE_PROC_STATE(&child->name, ORTE_PROC_STATE_FAILED_TO_LAUNCH);
890+
for (idx=0; idx < orte_local_children->size; idx++) {
891+
if (NULL == (child = (orte_proc_t*)opal_pointer_array_get_item(orte_local_children, idx))) {
892+
continue;
893+
}
894+
if (OPAL_EQUAL == opal_dss.compare(&job, &(child->name.jobid), ORTE_JOBID)) {
895+
child->exit_code = ORTE_PROC_STATE_FAILED_TO_LAUNCH;
896+
ORTE_ACTIVATE_PROC_STATE(&child->name, ORTE_PROC_STATE_FAILED_TO_LAUNCH);
897+
}
898+
}
886899
goto ERROR_OUT;
887900
}
888901
/* don't have enough - wait a little time */
889902
ORTE_DETECT_TIMEOUT(1000, 1000, -1, timer_cb, caddy);
890-
if (NULL != argvsav) {
891-
opal_argv_free(argvsav);
892-
}
893903
return;
894904
}
895905
}

orte/mca/plm/rsh/plm_rsh_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ static void launch_daemons(int fd, short args, void *cbdata)
12001200
}
12011201
}
12021202
/* we need mpirun to be the first node on this list */
1203-
if (0 != strcmp(nodelist[0], orte_process_info.nodename)) {
1203+
if (NULL == nodelist || 0 != strcmp(nodelist[0], orte_process_info.nodename)) {
12041204
opal_argv_prepend_nosize(&nodelist, orte_process_info.nodename);
12051205
}
12061206
nlistflat = opal_argv_join(nodelist, ',');

orte/mca/rmaps/base/rmaps_base_map_job.c

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,16 @@ void orte_rmaps_base_display_map(orte_job_t *jdata)
467467
continue;
468468
}
469469
memset(tmp1, 0, 1024);
470-
orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR);
471-
if (NULL == bd) {
472-
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
473-
} else {
474-
if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(tmp1, sizeof(tmp1), node->topology->topo, bd->cpuset)) {
470+
if (orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR)) {
471+
if (NULL == bd) {
475472
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
473+
} else {
474+
if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(tmp1, sizeof(tmp1), node->topology->topo, bd->cpuset)) {
475+
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
476+
}
476477
}
478+
} else {
479+
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
477480
}
478481
opal_output(orte_clean_output, "\t\t<process rank=%s app_idx=%ld local_rank=%lu node_rank=%lu binding=%s>",
479482
ORTE_VPID_PRINT(proc->name.vpid), (long)proc->app_idx,
@@ -488,29 +491,33 @@ void orte_rmaps_base_display_map(orte_job_t *jdata)
488491
node = (orte_node_t*)opal_pointer_array_get_item(jdata->map->nodes, 0);
489492
p0 = (orte_proc_t*)opal_pointer_array_get_item(node->procs, 0);
490493
p0bitmap = NULL;
491-
orte_get_attribute(&p0->attributes, ORTE_PROC_CPU_BITMAP, (void**)&p0bitmap, OPAL_STRING);
492-
opal_output(orte_clean_output, "\t<locality>");
493-
for (j=1; j < node->procs->size; j++) {
494-
if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, j))) {
495-
continue;
494+
if (orte_get_attribute(&p0->attributes, ORTE_PROC_CPU_BITMAP, (void**)&p0bitmap, OPAL_STRING) &&
495+
NULL != p0bitmap) {
496+
opal_output(orte_clean_output, "\t<locality>");
497+
for (j=1; j < node->procs->size; j++) {
498+
if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, j))) {
499+
continue;
500+
}
501+
procbitmap = NULL;
502+
if (orte_get_attribute(&proc->attributes, ORTE_PROC_CPU_BITMAP, (void**)&procbitmap, OPAL_STRING) &&
503+
NULL != procbitmap) {
504+
locality = opal_hwloc_base_get_relative_locality(node->topology->topo,
505+
p0bitmap,
506+
procbitmap);
507+
opal_output(orte_clean_output, "\t\t<rank=%s rank=%s locality=%s>",
508+
ORTE_VPID_PRINT(p0->name.vpid),
509+
ORTE_VPID_PRINT(proc->name.vpid),
510+
opal_hwloc_base_print_locality(locality));
511+
}
512+
}
513+
opal_output(orte_clean_output, "\t</locality>\n</map>");
514+
fflush(stderr);
515+
if (NULL != p0bitmap) {
516+
free(p0bitmap);
517+
}
518+
if (NULL != procbitmap) {
519+
free(procbitmap);
496520
}
497-
procbitmap = NULL;
498-
orte_get_attribute(&proc->attributes, ORTE_PROC_CPU_BITMAP, (void**)&procbitmap, OPAL_STRING);
499-
locality = opal_hwloc_base_get_relative_locality(node->topology->topo,
500-
p0bitmap,
501-
procbitmap);
502-
opal_output(orte_clean_output, "\t\t<rank=%s rank=%s locality=%s>",
503-
ORTE_VPID_PRINT(p0->name.vpid),
504-
ORTE_VPID_PRINT(proc->name.vpid),
505-
opal_hwloc_base_print_locality(locality));
506-
}
507-
opal_output(orte_clean_output, "\t</locality>\n</map>");
508-
fflush(stderr);
509-
if (NULL != p0bitmap) {
510-
free(p0bitmap);
511-
}
512-
if (NULL != procbitmap) {
513-
free(procbitmap);
514521
}
515522
} else {
516523
opal_output(orte_clean_output, " Data for JOB %s offset %s", ORTE_JOBID_PRINT(jdata->jobid), ORTE_VPID_PRINT(jdata->offset));

0 commit comments

Comments
 (0)