1
1

Add some protection to ensure that dstore doesn't segfault if uninitialized

This commit was SVN r31606.
Этот коммит содержится в:
Ralph Castain 2014-05-02 16:39:45 +00:00
родитель 7b97da5163
Коммит 87b6c1cf99

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

@ -83,6 +83,10 @@ int opal_dstore_base_store(int dstorehandle,
{
opal_dstore_handle_t *hdl;
if (dstorehandle < 0) {
return OPAL_ERR_NOT_INITIALIZED;
}
if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
return OPAL_ERR_NOT_FOUND;
@ -99,6 +103,11 @@ void opal_dstore_base_commit(int dstorehandle,
{
opal_dstore_handle_t *hdl;
if (dstorehandle < 0) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_INITIALIZED);
return;
}
if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
return;
@ -119,6 +128,10 @@ int opal_dstore_base_fetch(int dstorehandle,
{
opal_dstore_handle_t *hdl;
if (dstorehandle < 0) {
return OPAL_ERR_NOT_INITIALIZED;
}
if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
return OPAL_ERR_NOT_FOUND;
@ -136,6 +149,10 @@ int opal_dstore_base_remove_data(int dstorehandle,
{
opal_dstore_handle_t *hdl;
if (dstorehandle < 0) {
return OPAL_ERR_NOT_INITIALIZED;
}
if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
return OPAL_ERR_NOT_FOUND;