Skip to content

Commit ae93945

Browse files
authored
Merge pull request #13571 from edgargabriel/topic/long-filename-fix
sharedfp/lockedfile: do not limit filename length
2 parents dd6a7a3 + a0593ad commit ae93945

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ int mca_sharedfp_lockedfile_component_init_query(bool enable_progress_threads,
7979
struct mca_sharedfp_base_module_2_0_0_t * mca_sharedfp_lockedfile_component_file_query(ompio_file_t *fh, int *priority) {
8080
struct flock lock;
8181
int fd, err;
82-
/*char *filename;*/
83-
char filename[256];
82+
char *filename;
8483
int rank;
8584
bool has_file_lock_support=false;
8685

@@ -117,7 +116,7 @@ struct mca_sharedfp_base_module_2_0_0_t * mca_sharedfp_lockedfile_component_file
117116

118117
/* Set the filename. */
119118
/*data filename created by appending .locktest.$rank to the original filename*/
120-
snprintf(filename, sizeof(filename), "%s%s%d",fh->f_filename,".locktest.",rank);
119+
opal_asprintf(&filename, "%s.locktest.%d",fh->f_filename, rank);
121120

122121
lock.l_type = F_WRLCK;
123122
lock.l_start = 0;
@@ -160,6 +159,7 @@ struct mca_sharedfp_base_module_2_0_0_t * mca_sharedfp_lockedfile_component_file
160159
close(fd);
161160
unlink( filename );
162161
}
162+
free(filename);
163163
/**priority=100;*/
164164
if(has_file_lock_support){
165165
return &lockedfile;

0 commit comments

Comments
 (0)