mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-05 16:20:10 +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
|
else
|
||||||
#endif
|
#endif
|
||||||
status = NC_EPARINIT;
|
status = NC_EPARINIT;
|
||||||
|
file->fh = MPI_FILE_NULL;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Get its length */
|
/* Get its length */
|
||||||
@ -1390,7 +1391,8 @@ closemagic(struct MagicFile* file)
|
|||||||
#ifdef USE_PARALLEL
|
#ifdef USE_PARALLEL
|
||||||
if (file->use_parallel) {
|
if (file->use_parallel) {
|
||||||
int retval;
|
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;}
|
{status = NC_EPARINIT; return status;}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user