diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm.h b/ompi/mca/sharedfp/sm/sharedfp_sm.h index acae03dc8d..8f0ae91fc7 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm.h +++ b/ompi/mca/sharedfp/sm/sharedfp_sm.h @@ -97,7 +97,6 @@ int mca_sharedfp_sm_iwrite (mca_io_ompio_file_t *fh, int count, struct ompi_datatype_t *datatype, ompi_request_t **request); - /*--------------------------------------------------------------* *Structures and definitions only for this component *--------------------------------------------------------------*/ @@ -105,7 +104,7 @@ int mca_sharedfp_sm_iwrite (mca_io_ompio_file_t *fh, struct sm_offset{ sem_t mutex; /* the mutex: a Posix memory-based semaphore */ long long offset; /* and the shared file pointer offset */ -} sm_offset; +}; /*This structure will hang off of the mca_sharedfp_base_data_t's *selected_module_data attribute diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index 932d30fdd7..aa6937bc8f 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -29,6 +29,8 @@ #include #include +#include + int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, char* filename, @@ -43,6 +45,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, char * filename_basename; char * sm_filename; struct sm_offset * sm_offset_ptr; + struct sm_offset sm_offset; int sm_fd; int rank; @@ -123,7 +126,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, /*TODO: is it necessary to write to the file first?*/ if( 0 == rank ){ - write(sm_fd, &sm_offset, sizeof(struct sm_offset)); + memset ( &sm_offset, 0, sizeof (struct sm_offset )); + write ( sm_fd, &sm_offset, sizeof(struct sm_offset)); } comm->c_coll.coll_barrier (comm, comm->c_coll.coll_barrier_module );