Merge pull request #1639 from jjhursey/topic/dl-open-null-fname
dl/dlopen/libltdl: Allow opal_dl_open to take a NULL filename.
Этот коммит содержится в:
Коммит
35ae7e33d7
@ -3,6 +3,7 @@
|
|||||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -32,7 +33,6 @@
|
|||||||
static void do_dlopen(const char *fname, int flags,
|
static void do_dlopen(const char *fname, int flags,
|
||||||
void **handle, char **err_msg)
|
void **handle, char **err_msg)
|
||||||
{
|
{
|
||||||
assert(fname);
|
|
||||||
assert(handle);
|
assert(handle);
|
||||||
|
|
||||||
*handle = dlopen(fname, flags);
|
*handle = dlopen(fname, flags);
|
||||||
@ -50,7 +50,6 @@ static void do_dlopen(const char *fname, int flags,
|
|||||||
static int dlopen_open(const char *fname, bool use_ext, bool private_namespace,
|
static int dlopen_open(const char *fname, bool use_ext, bool private_namespace,
|
||||||
opal_dl_handle_t **handle, char **err_msg)
|
opal_dl_handle_t **handle, char **err_msg)
|
||||||
{
|
{
|
||||||
assert(fname);
|
|
||||||
assert(handle);
|
assert(handle);
|
||||||
|
|
||||||
*handle = NULL;
|
*handle = NULL;
|
||||||
@ -66,7 +65,7 @@ static int dlopen_open(const char *fname, bool use_ext, bool private_namespace,
|
|||||||
/* If the caller wants to use filename extensions, loop through
|
/* If the caller wants to use filename extensions, loop through
|
||||||
them */
|
them */
|
||||||
void *local_handle = NULL;
|
void *local_handle = NULL;
|
||||||
if (use_ext) {
|
if (use_ext && NULL != fname) {
|
||||||
int i;
|
int i;
|
||||||
char *ext;
|
char *ext;
|
||||||
|
|
||||||
@ -109,7 +108,12 @@ static int dlopen_open(const char *fname, bool use_ext, bool private_namespace,
|
|||||||
(*handle)->dlopen_handle = local_handle;
|
(*handle)->dlopen_handle = local_handle;
|
||||||
|
|
||||||
#if OPAL_ENABLE_DEBUG
|
#if OPAL_ENABLE_DEBUG
|
||||||
(*handle)->filename = strdup(fname);
|
if( NULL != fname ) {
|
||||||
|
(*handle)->filename = strdup(fname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(*handle)->filename = strdup("(null)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return (NULL != local_handle) ? OPAL_SUCCESS : OPAL_ERROR;
|
return (NULL != local_handle) ? OPAL_SUCCESS : OPAL_ERROR;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -18,7 +19,6 @@
|
|||||||
static int libltdl_open(const char *fname, bool use_ext, bool private_namespace,
|
static int libltdl_open(const char *fname, bool use_ext, bool private_namespace,
|
||||||
opal_dl_handle_t **handle, char **err_msg)
|
opal_dl_handle_t **handle, char **err_msg)
|
||||||
{
|
{
|
||||||
assert(fname);
|
|
||||||
assert(handle);
|
assert(handle);
|
||||||
|
|
||||||
*handle = NULL;
|
*handle = NULL;
|
||||||
@ -53,7 +53,12 @@ static int libltdl_open(const char *fname, bool use_ext, bool private_namespace,
|
|||||||
(*handle)->ltdl_handle = local_handle;
|
(*handle)->ltdl_handle = local_handle;
|
||||||
|
|
||||||
#if OPAL_ENABLE_DEBUG
|
#if OPAL_ENABLE_DEBUG
|
||||||
(*handle)->filename = strdup(fname);
|
if( NULL != fname ) {
|
||||||
|
(*handle)->filename = strdup(fname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(*handle)->filename = strdup("(null)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user