mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
ensuring that MPI_File_close() is only called on open MPI file handle
This commit is contained in:
parent
dd4edd09eb
commit
9ffc8d6d42
@ -1254,6 +1254,7 @@ openmagic(struct MagicFile* file)
|
||||
else
|
||||
#endif
|
||||
status = NC_EPARINIT;
|
||||
file->fh = MPI_FILE_NULL;
|
||||
goto done;
|
||||
}
|
||||
/* Get its length */
|
||||
@ -1390,7 +1391,8 @@ closemagic(struct MagicFile* file)
|
||||
#ifdef USE_PARALLEL
|
||||
if (file->use_parallel) {
|
||||
int retval;
|
||||
if((retval = MPI_File_close(&file->fh)) != MPI_SUCCESS)
|
||||
if(file->fh != MPI_FILE_NULL
|
||||
&& (retval = MPI_File_close(&file->fh)) != MPI_SUCCESS)
|
||||
{status = NC_EPARINIT; return status;}
|
||||
} else
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user