From b0954a6a3e705019c8209cf56b261ed0aa16cc5e Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 28 Jun 2012 15:15:47 +0000 Subject: [PATCH] set the internal OMPIO file pointer to the end of the file if file has been opened using the APPEND mode. This commit was SVN r26692. --- ompi/mca/io/ompio/io_ompio_file_open.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index d854878e85..659fb39ff5 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -120,6 +120,18 @@ mca_io_ompio_file_open (ompi_communicator_t *comm, } fh->f_flags |= OMPIO_FILE_IS_OPEN; + + /* If file has been opened in the append mode, move the internal + file pointer of OMPIO to the very end of the file. */ + if ( data->ompio_fh.f_amode & MPI_MODE_APPEND ) { + OMPI_MPI_OFFSET_TYPE current_size; + + data->ompio_fh.f_fs->fs_file_get_size (&data->ompio_fh, + ¤t_size); + ompi_io_ompio_set_explicit_offset (&data->ompio_fh, current_size); + } + + return OMPI_SUCCESS;