@@ -78,9 +78,15 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
7878 ompi_proc_t * masterproc = ompi_group_peer_lookup (comm -> c_local_group , 0 );
7979 masterjobid = OMPI_CAST_RTE_NAME (& masterproc -> super .proc_name )-> jobid ;
8080 }
81- comm -> c_coll -> coll_bcast ( & masterjobid , 1 , MPI_UNSIGNED , 0 , comm ,
82- comm -> c_coll -> coll_bcast_module );
83-
81+ err = comm -> c_coll -> coll_bcast ( & masterjobid , 1 , MPI_UNSIGNED , 0 , comm ,
82+ comm -> c_coll -> coll_bcast_module );
83+ if ( OMPI_SUCCESS != err ) {
84+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error in bcast operation\n" , fh -> f_rank );
85+ free (sh );
86+ free (module_data );
87+ return err ;
88+ }
89+
8490 size_t filenamelen = strlen (filename ) + 16 ;
8591 lockedfilename = (char * )malloc (sizeof (char ) * filenamelen );
8692 if ( NULL == lockedfilename ) {
@@ -100,16 +106,33 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
100106 *therefore there is no need to lock the file
101107 */
102108 handle = open ( lockedfilename , O_RDWR | O_CREAT , 0644 );
109+ if ( -1 == handle ){
110+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n" ,
111+ fh -> f_rank );
112+ free (sh );
113+ free (module_data );
114+ free (lockedfilename );
115+ return OMPI_ERROR ;
116+ }
103117 write ( handle , & position , sizeof (OMPI_MPI_OFFSET_TYPE ) );
104118 close ( handle );
105119 }
106- comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
120+ err = comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
121+ if ( OMPI_SUCCESS != err ) {
122+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error in barrier operation\n" , fh -> f_rank );
123+ free (sh );
124+ free (module_data );
125+ free (lockedfilename );
126+ return err ;
127+ }
107128
108129 handle = open ( lockedfilename , O_RDWR , 0644 );
109130 if ( -1 == handle ) {
110- opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n" , fh -> f_rank );
131+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n" ,
132+ fh -> f_rank );
111133 free (sh );
112134 free (module_data );
135+ free (lockedfilename );
113136 return OMPI_ERROR ;
114137 }
115138
@@ -120,9 +143,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
120143 /*remember the shared file handle*/
121144 fh -> f_sharedfp_data = sh ;
122145
123- comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
124-
125- return err ;
146+ return comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
126147}
127148
128149int mca_sharedfp_lockedfile_file_close (ompio_file_t * fh )
0 commit comments