summaryrefslogtreecommitdiffstats
path: root/test/stream_test.c
diff options
context:
space:
mode:
authorThomas Radke <tradke@aei.mpg.de>2000-11-08 22:47:35 (GMT)
committerThomas Radke <tradke@aei.mpg.de>2000-11-08 22:47:35 (GMT)
commit025fb428a3d271176e25c4e75ca540f74f0bc936 (patch)
tree76949c5409bf0c98e95c22166bfb94115459197c /test/stream_test.c
parent7fe0f3bb25419e5f8642f0c82b69e331ce0608c5 (diff)
downloadhdf5-025fb428a3d271176e25c4e75ca540f74f0bc936.zip
hdf5-025fb428a3d271176e25c4e75ca540f74f0bc936.tar.gz
hdf5-025fb428a3d271176e25c4e75ca540f74f0bc936.tar.bz2
[svn-r2834]
Purpose: Bugfix Description: The stream_test program reported an error under Linux SMP for testing the Stream VFD although everything seemed to be fine. Solution: The sender and receiver process which are forked by main() called return(retcode) at exit which implies closing open file descriptors. Since these are shared this caused a SEGFAULT in either the sender or the receiver when exiting. Replacing return() by _exit() is the right way to terminate the forked processes in this case. Platforms tested: Linux SMP (eirene)
Diffstat (limited to 'test/stream_test.c')
-rw-r--r--test/stream_test.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/test/stream_test.c b/test/stream_test.c
index 239c2c6..167bda1 100644
--- a/test/stream_test.c
+++ b/test/stream_test.c
@@ -11,6 +11,8 @@
* Modifications:
* Thomas Radke, Thursday, October 26, 2000
* Made it compiling under Windows.
+ * Thomas Radke, Wednesday, November 8, 2000
+ * Use _exit(2) instead of return() in the sender and receiver.
*
*/
@@ -84,7 +86,7 @@ static int sender (void)
if (fapl < 0)
{
fprintf (stderr, "sender: couldn't create file access property list\n");
- return (-1);
+ _exit (-1);
}
status = H5Pset_fapl_stream (fapl, NULL);
@@ -93,7 +95,7 @@ static int sender (void)
fprintf (stderr, "sender: couldn't set file access property list "
"for Stream VFD\n");
H5Pclose (fapl);
- return (-2);
+ _exit (-2);
}
/*
@@ -108,7 +110,7 @@ static int sender (void)
{
fprintf (stderr, "sender: couldn't create dataspace\n");
H5Pclose (fapl);
- return (-3);
+ _exit (-3);
}
/*
@@ -122,7 +124,7 @@ static int sender (void)
"%d integers\n", i);
H5Sclose (dataspace);
H5Pclose (fapl);
- return (-4);
+ _exit (-4);
}
while (--i >= 0)
{
@@ -142,7 +144,7 @@ static int sender (void)
free (data);
H5Sclose (dataspace);
H5Pclose (fapl);
- return (-5);
+ _exit (-5);
}
/*
@@ -158,7 +160,7 @@ static int sender (void)
H5Fclose (file);
H5Sclose (dataspace);
H5Pclose (fapl);
- return (-6);
+ _exit (-6);
}
/*
@@ -176,7 +178,7 @@ static int sender (void)
H5Sclose (dataspace);
H5Pclose (fapl);
fprintf (stderr, "sender: couldn't write dataset\n");
- return (-7);
+ _exit (-7);
}
/*
@@ -192,6 +194,12 @@ static int sender (void)
H5Pclose (fapl);
free (data);
+ _exit (0);
+
+ /*
+ * This is just to get rid of the compiler warning
+ * 'function does not return a value.
+ */
return (0);
}
@@ -219,7 +227,7 @@ static int receiver (void)
if (fapl < 0)
{
fprintf (stderr, "receiver: couldn't create file access property list\n");
- return (-1);
+ _exit (-1);
}
status = H5Pset_fapl_stream (fapl, NULL);
@@ -227,7 +235,7 @@ static int receiver (void)
{
fprintf (stderr, "receiver: couldn't set file access property list "
"for Stream VFD\n");
- return (-2);
+ _exit (-2);
}
/*
@@ -241,7 +249,7 @@ static int receiver (void)
if (file < 0)
{
fprintf (stderr, "receiver: couldn't open file from '%s'\n", FILENAME);
- return (-3);
+ _exit (-3);
}
/*
@@ -252,7 +260,7 @@ static int receiver (void)
if (dataset < 0)
{
fprintf (stderr, "receiver: couldn't open dataset '%s'\n", DATASETNAME);
- return (-4);
+ _exit (-4);
}
/*
@@ -319,7 +327,13 @@ static int receiver (void)
free (data);
- return (-nerrors);
+ _exit (-nerrors);
+
+ /*
+ * This is just to get rid of the compiler warning
+ * 'function does not return a value.
+ */
+ return (0);
}