Skip to content

Commit faf0f9b

Browse files
rhc54hppritcha
authored andcommitted
Minor cleanups in tool connection
Don't return a NULL to the PMIx server library's tool connected routine. Instead, wait until we process all the provided keys to (hopefully) capture the tool's procID and then return it with an error, if we hit one. Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit 6b0217c)
1 parent 707cea5 commit faf0f9b

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

src/prted/pmix/pmix_server_gen.c

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ static void _toolconn(int sd, short args, void *cbdata)
508508
size_t n;
509509
pmix_data_buffer_t *buf;
510510
prte_plm_cmd_flag_t command = PRTE_PLM_ALLOC_JOBID_CMD;
511-
pmix_status_t xrc;
511+
pmix_status_t xrc = PMIX_SUCCESS, trc;
512512
bool primary = false;
513513
bool nspace_given = false;
514514
bool rank_given = false;
@@ -528,22 +528,14 @@ static void _toolconn(int sd, short args, void *cbdata)
528528
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_VERSION_INFO)) {
529529
/* we ignore this for now */
530530
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_USERID)) {
531-
PMIX_VALUE_GET_NUMBER(xrc, &cd->info[n].value, cd->uid, uid_t);
532-
if (PMIX_SUCCESS != xrc) {
533-
if (NULL != cd->toolcbfunc) {
534-
cd->toolcbfunc(xrc, NULL, cd->cbdata);
535-
}
536-
PMIX_RELEASE(cd);
537-
return;
531+
PMIX_VALUE_GET_NUMBER(trc, &cd->info[n].value, cd->uid, uid_t);
532+
if (PMIX_SUCCESS == xrc && PMIX_SUCCESS != trc) {
533+
xrc = trc;
538534
}
539535
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_GRPID)) {
540-
PMIX_VALUE_GET_NUMBER(xrc, &cd->info[n].value, cd->gid, gid_t);
541-
if (PMIX_SUCCESS != xrc) {
542-
if (NULL != cd->toolcbfunc) {
543-
cd->toolcbfunc(xrc, NULL, cd->cbdata);
544-
}
545-
PMIX_RELEASE(cd);
546-
return;
536+
PMIX_VALUE_GET_NUMBER(trc, &cd->info[n].value, cd->gid, gid_t);
537+
if (PMIX_SUCCESS == xrc && PMIX_SUCCESS != trc) {
538+
xrc = trc;
547539
}
548540
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_NSPACE)) {
549541
PMIX_LOAD_NSPACE(cd->target.nspace, cd->info[n].value.data.string);
@@ -562,18 +554,22 @@ static void _toolconn(int sd, short args, void *cbdata)
562554
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_PRIMARY_SERVER)) {
563555
primary = PMIX_INFO_TRUE(&cd->info[n]);
564556
} else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_PROC_PID)) {
565-
PMIX_VALUE_GET_NUMBER(xrc, &cd->info[n].value, cd->pid, pid_t);
566-
if (PMIX_SUCCESS != xrc) {
567-
if (NULL != cd->toolcbfunc) {
568-
cd->toolcbfunc(xrc, NULL, cd->cbdata);
569-
}
570-
PMIX_RELEASE(cd);
571-
return;
557+
PMIX_VALUE_GET_NUMBER(trc, &cd->info[n].value, cd->pid, pid_t);
558+
if (PMIX_SUCCESS == xrc && PMIX_SUCCESS != trc) {
559+
xrc = trc;
572560
}
573561
}
574562
}
575563
}
576564

565+
if (PMIX_SUCCESS != xrc) {
566+
if (NULL != cd->toolcbfunc) {
567+
cd->toolcbfunc(xrc, &cd->target, cd->cbdata);
568+
}
569+
PMIX_RELEASE(cd);
570+
return;
571+
}
572+
577573
pmix_output_verbose(2, prte_pmix_server_globals.output,
578574
"%s %s CONNECTION FROM UID %d GID %d NSPACE %s",
579575
PRTE_NAME_PRINT(PRTE_PROC_MY_NAME),

0 commit comments

Comments
 (0)