14
14
* and Technology (RIST). All rights reserved.
15
15
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
16
16
* reserved.
17
- * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
17
+ * Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
18
18
* Copyright (c) 2021-2022 IBM Corporation. All rights reserved.
19
19
* $COPYRIGHT$
20
20
*/
@@ -69,6 +69,7 @@ opal_process_name_t pmix_name_invalid = {UINT32_MAX, UINT32_MAX};
69
69
* session directory structure, then we shall cleanup after ourselves.
70
70
*/
71
71
static bool destroy_job_session_dir = false;
72
+ static bool destroy_proc_session_dir = false;
72
73
73
74
static int _setup_top_session_dir (char * * sdir );
74
75
static int _setup_job_session_dir (char * * sdir );
@@ -995,9 +996,12 @@ int ompi_rte_finalize(void)
995
996
opal_process_info .top_session_dir = NULL ;
996
997
}
997
998
998
- if (NULL != opal_process_info .proc_session_dir ) {
999
+ if (NULL != opal_process_info .proc_session_dir && destroy_proc_session_dir ) {
1000
+ opal_os_dirpath_destroy (opal_process_info .proc_session_dir ,
1001
+ false, check_file );
999
1002
free (opal_process_info .proc_session_dir );
1000
1003
opal_process_info .proc_session_dir = NULL ;
1004
+ destroy_proc_session_dir = false;
1001
1005
}
1002
1006
1003
1007
if (NULL != opal_process_info .app_sizes ) {
@@ -1174,6 +1178,7 @@ static int _setup_top_session_dir(char **sdir)
1174
1178
1175
1179
static int _setup_job_session_dir (char * * sdir )
1176
1180
{
1181
+ int rc ;
1177
1182
/* get the effective uid */
1178
1183
uid_t uid = geteuid ();
1179
1184
@@ -1185,18 +1190,33 @@ static int _setup_job_session_dir(char **sdir)
1185
1190
opal_process_info .job_session_dir = NULL ;
1186
1191
return OPAL_ERR_OUT_OF_RESOURCE ;
1187
1192
}
1193
+ rc = opal_os_dirpath_create (opal_process_info .job_session_dir , 0755 );
1194
+ if (OPAL_SUCCESS != rc ) {
1195
+ // could not create session dir
1196
+ free (opal_process_info .job_session_dir );
1197
+ opal_process_info .job_session_dir = NULL ;
1198
+ return rc ;
1199
+ }
1188
1200
destroy_job_session_dir = true;
1189
1201
return OPAL_SUCCESS ;
1190
1202
}
1191
1203
1192
1204
static int _setup_proc_session_dir (char * * sdir )
1193
1205
{
1206
+ int rc ;
1207
+
1194
1208
if (0 > opal_asprintf (sdir , "%s/%d" ,
1195
1209
opal_process_info .job_session_dir ,
1196
1210
opal_process_info .my_name .vpid )) {
1197
1211
opal_process_info .proc_session_dir = NULL ;
1198
1212
return OPAL_ERR_OUT_OF_RESOURCE ;
1199
1213
}
1200
-
1214
+ rc = opal_os_dirpath_create (opal_process_info .proc_session_dir , 0755 );
1215
+ if (OPAL_SUCCESS != rc ) {
1216
+ // could not create session dir
1217
+ free (opal_process_info .proc_session_dir );
1218
+ opal_process_info .proc_session_dir = NULL ;
1219
+ return rc ;
1220
+ }
1201
1221
return OPAL_SUCCESS ;
1202
1222
}
0 commit comments