Skip to content

Commit 8ae10c9

Browse files
author
Ralph Castain
committed
Ensure we exit with an appropriate error code when hitting a PMI2 error
Signed-off-by: Ralph Castain <[email protected]>
1 parent 835fa33 commit 8ae10c9

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

opal/mca/pmix/s2/pmix_s2.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ static int s2_init(opal_list_t *ilist)
195195
}
196196
if( size < 0 || rank < 0 ){
197197
opal_show_help("help-pmix-base.txt", "pmix2-init-returned-bad-values", true);
198+
ret = OPAL_ERR_BAD_PARAM;
198199
goto err_exit;
199200
}
200201

@@ -218,6 +219,7 @@ static int s2_init(opal_list_t *ilist)
218219
if( PMI2_SUCCESS != rc ) {
219220
OPAL_PMI_ERROR(rc, "PMI2_Job_GetId");
220221
free(pmix_kvs_name);
222+
ret = OPAL_ERR_BAD_PARAM;
221223
goto err_exit;
222224
}
223225

@@ -262,8 +264,8 @@ static int s2_init(opal_list_t *ilist)
262264
kv.key = strdup(OPAL_PMIX_JOB_SIZE);
263265
kv.type = OPAL_UINT32;
264266
kv.data.uint32 = size;
265-
if (OPAL_SUCCESS != (rc = opal_pmix_base_store(&wildcard_rank, &kv))) {
266-
OPAL_ERROR_LOG(rc);
267+
if (OPAL_SUCCESS != (ret = opal_pmix_base_store(&wildcard_rank, &kv))) {
268+
OPAL_ERROR_LOG(ret);
267269
OBJ_DESTRUCT(&kv);
268270
goto err_exit;
269271
}
@@ -284,15 +286,16 @@ static int s2_init(opal_list_t *ilist)
284286
rc = PMI2_Info_GetJobAttr("universeSize", buf, 16, &found);
285287
if( PMI2_SUCCESS != rc ) {
286288
OPAL_PMI_ERROR(rc, "PMI_Get_universe_size");
289+
ret = OPAL_ERR_BAD_PARAM;
287290
goto err_exit;
288291
}
289292
/* save it */
290293
OBJ_CONSTRUCT(&kv, opal_value_t);
291294
kv.key = strdup(OPAL_PMIX_UNIV_SIZE);
292295
kv.type = OPAL_UINT32;
293296
kv.data.uint32 = atoi(buf);
294-
if (OPAL_SUCCESS != (rc = opal_pmix_base_store(&wildcard_rank, &kv))) {
295-
OPAL_ERROR_LOG(rc);
297+
if (OPAL_SUCCESS != (ret = opal_pmix_base_store(&wildcard_rank, &kv))) {
298+
OPAL_ERROR_LOG(ret);
296299
OBJ_DESTRUCT(&kv);
297300
goto err_exit;
298301
}
@@ -311,22 +314,23 @@ static int s2_init(opal_list_t *ilist)
311314

312315
char *pmapping = (char*)malloc(PMI2_MAX_VALLEN);
313316
if( pmapping == NULL ){
314-
rc = OPAL_ERR_OUT_OF_RESOURCE;
315-
OPAL_ERROR_LOG(rc);
316-
return rc;
317+
ret = OPAL_ERR_OUT_OF_RESOURCE;
318+
OPAL_ERROR_LOG(ret);
319+
goto err_exit;
317320
}
318321

319322
rc = PMI2_Info_GetJobAttr("PMI_process_mapping", pmapping, PMI2_MAX_VALLEN, &found);
320323
if( !found || PMI2_SUCCESS != rc ) {
321324
OPAL_PMI_ERROR(rc,"PMI2_Info_GetJobAttr");
322-
return OPAL_ERROR;
325+
ret = OPAL_ERR_BAD_PARAM;
326+
goto err_exit;
323327
}
324328

325329
s2_lranks = mca_common_pmi2_parse_pmap(pmapping, s2_pname.vpid, &my_node, &s2_nlranks);
326330
if (NULL == s2_lranks) {
327-
rc = OPAL_ERR_OUT_OF_RESOURCE;
328-
OPAL_ERROR_LOG(rc);
329-
return rc;
331+
ret = OPAL_ERR_OUT_OF_RESOURCE;
332+
OPAL_ERROR_LOG(ret);
333+
goto err_exit;
330334
}
331335

332336
free(pmapping);
@@ -336,8 +340,8 @@ static int s2_init(opal_list_t *ilist)
336340
kv.key = strdup(OPAL_PMIX_LOCAL_SIZE);
337341
kv.type = OPAL_UINT32;
338342
kv.data.uint32 = s2_nlranks;
339-
if (OPAL_SUCCESS != (rc = opal_pmix_base_store(&wildcard_rank, &kv))) {
340-
OPAL_ERROR_LOG(rc);
343+
if (OPAL_SUCCESS != (ret = opal_pmix_base_store(&wildcard_rank, &kv))) {
344+
OPAL_ERROR_LOG(ret);
341345
OBJ_DESTRUCT(&kv);
342346
goto err_exit;
343347
}

0 commit comments

Comments
 (0)