1
1

Prevent a segfault if we encounter an error while parsing a hostfile. Don't issue and error_log output as the hostfile code already prints an error message

Thanks to Tetsuya Mishima for the patch. Reviewed ok by rhc.

RM-approved

cmr=v1.8.1:reviewer=ompi-gk1.8

This commit was SVN r31377.
Этот коммит содержится в:
Ralph Castain 2014-04-12 21:32:10 +00:00
родитель 2d8dff837c
Коммит deff85ffc3
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -254,7 +254,6 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
/* a default hostfile was provided - parse it */ /* a default hostfile was provided - parse it */
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes, if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
orte_default_hostfile))) { orte_default_hostfile))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&nodes); OBJ_DESTRUCT(&nodes);
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE); ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
OBJ_RELEASE(caddy); OBJ_RELEASE(caddy);
@ -270,7 +269,6 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
/* a rankfile was provided - parse it */ /* a rankfile was provided - parse it */
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes, if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
orte_rankfile))) { orte_rankfile))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&nodes); OBJ_DESTRUCT(&nodes);
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE); ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
OBJ_RELEASE(caddy); OBJ_RELEASE(caddy);
@ -290,7 +288,6 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
/* hostfile was specified - parse it and add it to the list */ /* hostfile was specified - parse it and add it to the list */
if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes, if (ORTE_SUCCESS != (rc = orte_util_add_hostfile_nodes(&nodes,
app->hostfile))) { app->hostfile))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&nodes); OBJ_DESTRUCT(&nodes);
/* set an error event */ /* set an error event */
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE); ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
@ -310,7 +307,6 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes, if (ORTE_SUCCESS != (rc = orte_util_add_dash_host_nodes(&nodes,
app->dash_host))) { app->dash_host))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&nodes); OBJ_DESTRUCT(&nodes);
ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE); ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE);
OBJ_RELEASE(caddy); OBJ_RELEASE(caddy);

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

@ -336,6 +336,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
orte_show_help("help-hostfile.txt", "slots", orte_show_help("help-hostfile.txt", "slots",
true, true,
cur_hostfile_name, rc); cur_hostfile_name, rc);
opal_list_remove_item(updates, &node->super);
OBJ_RELEASE(node); OBJ_RELEASE(node);
return ORTE_ERROR; return ORTE_ERROR;
} }
@ -346,6 +347,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
orte_show_help("help-hostfile.txt", "slots-given", orte_show_help("help-hostfile.txt", "slots-given",
true, true,
cur_hostfile_name, node->name); cur_hostfile_name, node->name);
opal_list_remove_item(updates, &node->super);
OBJ_RELEASE(node); OBJ_RELEASE(node);
return ORTE_ERROR; return ORTE_ERROR;
} }
@ -364,6 +366,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
orte_show_help("help-hostfile.txt", "max_slots", orte_show_help("help-hostfile.txt", "max_slots",
true, true,
cur_hostfile_name, ((size_t) rc)); cur_hostfile_name, ((size_t) rc));
opal_list_remove_item(updates, &node->super);
OBJ_RELEASE(node); OBJ_RELEASE(node);
return ORTE_ERROR; return ORTE_ERROR;
} }
@ -378,6 +381,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
true, true,
cur_hostfile_name, node->slots, rc); cur_hostfile_name, node->slots, rc);
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
opal_list_remove_item(updates, &node->super);
OBJ_RELEASE(node); OBJ_RELEASE(node);
return ORTE_ERROR; return ORTE_ERROR;
} }
@ -385,11 +389,13 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
default: default:
hostfile_parse_error(token); hostfile_parse_error(token);
opal_list_remove_item(updates, &node->super);
OBJ_RELEASE(node); OBJ_RELEASE(node);
return ORTE_ERROR; return ORTE_ERROR;
} }
if (number_of_slots > node->slots) { if (number_of_slots > node->slots) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
opal_list_remove_item(updates, &node->super);
OBJ_RELEASE(node); OBJ_RELEASE(node);
return ORTE_ERROR; return ORTE_ERROR;
} }