Skip to content

Commit 282c180

Browse files
committed
mpi/info_delete: fix return code
Per MPI-3.1, ensure to raise an MPI exception with value MPI_ERR_INFO_NOKEY if we try to MPI_INFO_DELETE a key that does not exist. Thanks to @dalcinl (Lisando Dalcin) for raising the issue. Signed-off-by: Jeff Squyres <[email protected]> (cherry picked from commit ea5093f)
1 parent c38af8e commit 282c180

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ompi/mpi/c/info_delete.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* reserved.
1515
* Copyright (c) 2015 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2017 Cisco Systems, Inc. All rights reserved
1718
* $COPYRIGHT$
1819
*
1920
* Additional copyrights may follow
@@ -78,5 +79,14 @@ int MPI_Info_delete(MPI_Info info, const char *key) {
7879
OPAL_CR_ENTER_LIBRARY();
7980

8081
err = ompi_info_delete (info, key);
82+
83+
// Note that ompi_info_delete() (i.e., opal_info_delete()) will
84+
// return OPAL_ERR_NOT_FOUND if there was no corresponding key to
85+
// delete. Per MPI-3.1, we need to convert that to
86+
// MPI_ERR_INFO_NOKEY.
87+
if (OPAL_ERR_NOT_FOUND == err) {
88+
err = MPI_ERR_INFO_NOKEY;
89+
}
90+
8191
OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME);
8292
}

0 commit comments

Comments
 (0)