aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2002-02-21 17:34:34 +0000
committertradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2002-02-21 17:34:34 +0000
commitd0b9d5dd2f8f61d2a9cc5840e2efbceeedc89bb1 (patch)
treed7201967bd1903c86e126e38d9e57b0cb1cb78fe
parentd0ab15a9d49a932caeb2cedd57c8e0cc0c15191f (diff)
Check for invalid file handles passed into the dump routines.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@52 7842ec3a-9562-4be5-9c5b-06ba18f2b668
-rw-r--r--src/DumpVar.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/DumpVar.c b/src/DumpVar.c
index fdca24a..109df75 100644
--- a/src/DumpVar.c
+++ b/src/DumpVar.c
@@ -269,7 +269,7 @@ int IOHDF5Util_DumpVar (const cGH *GH,
@returntype int
@returndesc
- always 0
+ 0 for success, or -1 if file handle is invalid
@endreturndesc
@@*/
static int IOHDF5Util_DumpGS (const cGH *GH,
@@ -288,6 +288,12 @@ static int IOHDF5Util_DumpGS (const cGH *GH,
static CCTK_INT global_shape[1] = {0};
+ /* immediately return if file handle is invalid */
+ if (file < 0)
+ {
+ return (-1);
+ }
+
/* Get the handles for IOHDF5Util and IOUtil extensions */
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
@@ -723,6 +729,12 @@ static void IOHDF5Util_procDump (const cGH *GH,
DECLARE_CCTK_PARAMETERS
+ /* immediately return if file handle is invalid */
+ if (file < 0)
+ {
+ return;
+ }
+
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
@@ -959,6 +971,12 @@ static void IOHDF5Util_collectiveDump (const cGH *GH,
DECLARE_CCTK_PARAMETERS
+ /* immediately return if file handle is invalid */
+ if (file < 0)
+ {
+ return;
+ }
+
myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
/* get the dimension of the variable */