1
1

orte_quit: Remove logically dead code

CID 71993 Logically dead code (DEADCODE)

As indicated by coverity proc can not be NULL at any point after the
continue. Removed dead code.

CID 1269682 Unchecked return value (CHECKED_RETURN)

Check the return code of orte_get_attribute. I assume we still need to
check for a NULL proc in case the aborted proc attribute is set to
NULL. This might be better as an assert ().

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
Nathan Hjelm 2015-05-26 12:00:28 -06:00
родитель d21bd24126
Коммит 7db48c581d

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- C -*-
*
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
@ -168,9 +168,7 @@ static void dump_aborted_procs(void)
ORTE_JOB_STATE_RUNNING != job->state &&
ORTE_JOB_STATE_TERMINATED != job->state &&
ORTE_JOB_STATE_ABORT_ORDERED != job->state) {
/* this is a guilty party */
proc = NULL;
orte_get_attribute(&job->attributes, ORTE_JOB_ABORTED_PROC, (void**)&proc, OPAL_PTR);
/* cycle through and count the number that were killed or aborted */
for (i=0; i < job->procs->size; i++) {
if (NULL == (pptr = (orte_proc_t*)opal_pointer_array_get_item(job->procs, i))) {
@ -189,7 +187,10 @@ static void dump_aborted_procs(void)
}
}
if (NULL == proc) {
/* this is a guilty party */
proc = NULL;
if (!orte_get_attribute(&job->attributes, ORTE_JOB_ABORTED_PROC, (void**)&proc, OPAL_PTR) ||
NULL == proc) {
continue;
}
@ -197,11 +198,6 @@ static void dump_aborted_procs(void)
node = proc->node;
if (ORTE_JOB_STATE_FAILED_TO_START == job->state ||
ORTE_JOB_STATE_FAILED_TO_LAUNCH == job->state) {
if (NULL == proc) {
orte_show_help("help-orterun.txt", "orterun:proc-failed-to-start-no-status-no-node", true,
orte_basename);
return;
}
switch (proc->exit_code) {
case ORTE_ERR_SILENT:
/* say nothing - it was already reported */
@ -323,43 +319,28 @@ static void dump_aborted_procs(void)
break;
}
} else if (ORTE_JOB_STATE_ABORTED == job->state) {
if (NULL == proc) {
orte_show_help("help-orterun.txt", "orterun:proc-aborted-unknown", true,
orte_basename);
} else {
orte_show_help("help-orterun.txt", "orterun:proc-ordered-abort", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, orte_basename);
}
orte_show_help("help-orterun.txt", "orterun:proc-ordered-abort", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, orte_basename);
} else if (ORTE_JOB_STATE_ABORTED_BY_SIG == job->state) { /* aborted by signal */
if (NULL == proc) {
orte_show_help("help-orterun.txt", "orterun:proc-aborted-signal-unknown", true,
orte_basename);
} else {
#ifdef HAVE_STRSIGNAL
if (NULL != strsignal(WTERMSIG(proc->exit_code))) {
orte_show_help("help-orterun.txt", "orterun:proc-aborted-strsignal", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, WTERMSIG(proc->exit_code),
strsignal(WTERMSIG(proc->exit_code)));
} else {
#endif
orte_show_help("help-orterun.txt", "orterun:proc-aborted", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, WTERMSIG(proc->exit_code));
#ifdef HAVE_STRSIGNAL
}
#endif
}
} else if (ORTE_JOB_STATE_ABORTED_WO_SYNC == job->state) { /* proc exited w/o finalize */
if (NULL == proc) {
orte_show_help("help-orterun.txt", "orterun:proc-exit-no-sync-unknown", true,
orte_basename, orte_basename);
} else {
orte_show_help("help-orterun.txt", "orterun:proc-exit-no-sync", true,
if (NULL != strsignal(WTERMSIG(proc->exit_code))) {
orte_show_help("help-orterun.txt", "orterun:proc-aborted-strsignal", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, orte_basename, orte_basename);
node->name, WTERMSIG(proc->exit_code),
strsignal(WTERMSIG(proc->exit_code)));
} else {
#endif
orte_show_help("help-orterun.txt", "orterun:proc-aborted", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, WTERMSIG(proc->exit_code));
#ifdef HAVE_STRSIGNAL
}
#endif
} else if (ORTE_JOB_STATE_ABORTED_WO_SYNC == job->state) { /* proc exited w/o finalize */
orte_show_help("help-orterun.txt", "orterun:proc-exit-no-sync", true,
orte_basename, (unsigned long)proc->name.vpid, (unsigned long)proc->pid,
node->name, orte_basename, orte_basename);
} else if (ORTE_JOB_STATE_COMM_FAILED == job->state) {
orte_show_help("help-orterun.txt", "orterun:proc-comm-failed", true,
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),