about summary refs log tree commit diff
path: root/rt/tst-aio7.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-30 07:19:21 +0000
committerRoland McGrath <roland@gnu.org>2002-09-30 07:19:21 +0000
commit8fe802e8c76d18e0cf711cdf708d04412194146e (patch)
tree706fec579a0ef7997c78b14896f6142a842c72d9 /rt/tst-aio7.c
parent5d865001d84678e696b62126d4c49ad730a1b0a8 (diff)
downloadglibc-8fe802e8c76d18e0cf711cdf708d04412194146e.tar.gz
glibc-8fe802e8c76d18e0cf711cdf708d04412194146e.tar.xz
glibc-8fe802e8c76d18e0cf711cdf708d04412194146e.zip
2002-09-30 Roland McGrath <roland@redhat.com>
	* rt/tst-aio7.c (do_test): Don't read from stdin, which could be the
	terminal when the test is running in a background job.  Instead, make
	a pipe and read from its read half while never writing anything to it.
Diffstat (limited to 'rt/tst-aio7.c')
-rw-r--r--rt/tst-aio7.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/rt/tst-aio7.c b/rt/tst-aio7.c
index ecb45cb156..b4903c7892 100644
--- a/rt/tst-aio7.c
+++ b/rt/tst-aio7.c
@@ -34,6 +34,14 @@ static int
 do_test (void)
 {
   int result = 0;
+  int piped[2];
+
+  /* Make a pipe that we will never write to, so we can block reading it.  */
+  if (pipe (piped) < 0)
+    {
+      perror ("pipe");
+      return 1;
+    }
 
   /* Test for aio_cancel() detecting invalid file descriptor.  */
   {
@@ -146,9 +154,8 @@ do_test (void)
     printf ("\n");
 
     /* At this point, the first read is completed, so start another one on
-     * stdin, which will not complete unless the user inputs something.
-     */
-    cb1.aio_fildes = 0;
+       the read half of a pipe on which nothing will be written.  */
+    cb1.aio_fildes = piped[0];
     cb1.aio_offset = 0;
     cb1.aio_buf = buff;
     cb1.aio_nbytes = BYTES;