1
1

Merge pull request #7416 from hjelmn/lets_crash_on_debug_builds_if_the_user_home_directory_is_not_available

opal/mca: check if the user home directory is NULL
Этот коммит содержится в:
Nathan Hjelm 2020-02-17 17:50:07 -07:00 коммит произвёл GitHub
родитель eeb3d7f845 8197efa021
Коммит 73469cb847
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23

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

@ -403,9 +403,6 @@ int mca_base_var_cache_files(bool rel_path_search)
char *tmp; char *tmp;
int ret; int ret;
/* We may need this later */
home = (char*)opal_home_directory();
if (NULL == cwd) { if (NULL == cwd) {
cwd = (char *) malloc(sizeof(char) * MAXPATHLEN); cwd = (char *) malloc(sizeof(char) * MAXPATHLEN);
if( NULL == (cwd = getcwd(cwd, MAXPATHLEN) )) { if( NULL == (cwd = getcwd(cwd, MAXPATHLEN) )) {
@ -415,6 +412,13 @@ int mca_base_var_cache_files(bool rel_path_search)
} }
#if OPAL_WANT_HOME_CONFIG_FILES #if OPAL_WANT_HOME_CONFIG_FILES
/* We may need this later */
home = (char*)opal_home_directory();
if (NULL == home) {
opal_output(0, "Error: Unable to get the user home directory\n");
return OPAL_ERROR;
}
opal_asprintf(&mca_base_var_files, "%s"OPAL_PATH_SEP".openmpi" OPAL_PATH_SEP opal_asprintf(&mca_base_var_files, "%s"OPAL_PATH_SEP".openmpi" OPAL_PATH_SEP
"mca-params.conf%c%s" OPAL_PATH_SEP "openmpi-mca-params.conf", "mca-params.conf%c%s" OPAL_PATH_SEP "openmpi-mca-params.conf",
home, ',', opal_install_dirs.sysconfdir); home, ',', opal_install_dirs.sysconfdir);