9507.cc: Remove child process.
authorMark Mitchell <mark@codesourcery.com>
Wed, 5 Jan 2005 16:13:46 +0000 (16:13 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 5 Jan 2005 16:13:46 +0000 (16:13 +0000)
* testsuite/27_io/basic_filebuf/open/char/9507.cc: Remove child
process.

From-SVN: r92953

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/9507.cc

index 8322d5f9efc80e63ddbc47c2eed9d7bfa445fb5d..521f8fba981ae4668694be7d19f00ce11ba7a0d2 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-05  Mark Mitchell  <mark@codesourcery.com>
+
+       * testsuite/27_io/basic_filebuf/open/char/9507.cc: Remove child
+       process.
+       
 2005-01-05  Paolo Carlini  <pcarlini@suse.de>
 
        * src/istream.cc (basic_istream<char>::ignore(streamsize),
index 775c72c1c6ab1041d8c0ac667946737d317327f7..eacf8fa43de71244ee724ae705bc118fb2af183e 100644 (file)
@@ -37,33 +37,25 @@ void test_06()
   using namespace __gnu_test;
   bool test __attribute__((unused)) = true;
   const char* name = "tmp_fifo2";
-  semaphore s1, s2;
 
   signal(SIGPIPE, SIG_IGN);
 
   unlink(name);
   try_mkfifo(name, S_IRWXU);
   
-  if (!fork())
-    {
-      std::filebuf fbuf;
-      fbuf.open(name, std::ios_base::in);
-      fbuf.sgetc();
-      s1.signal ();
-      fbuf.close();
-      s2.wait ();
-      exit(0);
-    }
-
   std::filebuf fbuf;
+  // The use of ios_base::ate implies an attempt to seek on the file
+  // descriptor.  The seek will fail.  Thus, at the OS level, this
+  // call to "fbuf.open" will result in a call to "open" (which will
+  // succeed), a call to "lseek" (which will fail), and, finally, a
+  // call to "close" (which will succeed).  Thus, after this call, the
+  // file should be closed.
   std::filebuf* r = fbuf.open(name,
                              std::ios_base::in 
                              | std::ios_base::out
                              | std::ios_base::ate);
-  s1.wait ();
   VERIFY( !fbuf.is_open() );
   VERIFY( r == NULL );
-  s2.signal ();
 }
 
 int