]> granicus.if.org Git - check/commitdiff
Applied a patch from Arien that makes the pipe nonblocking. This doesn't
authorneo23 <neo23@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 14 Apr 2002 16:59:08 +0000 (16:59 +0000)
committerneo23 <neo23@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 14 Apr 2002 16:59:08 +0000 (16:59 +0000)
solve #482012 but makes it more obvious what is going wrong if the pipe
fills up.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@132 64e312b2-a51f-0410-8e61-82d0ca0eb02a

check/src/check_msg.c

index ae7b8e03e66c77fa2ce21e820052ef88130bb8da..5827fcaf34058dd2267ebfc3f411b947b072083a 100644 (file)
  */
 
 #include <sys/types.h>
-#include "unistd.h"
-#include "stdlib.h"
-#include "stdio.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <stdio.h>
 #include "list.h"
 #include "check_error.h"
 #include "check.h"
@@ -242,11 +243,21 @@ static void setup_pipe (Pipe *p)
 {
   int fd[2];
 
-  pipe(fd);
+  pipe (fd);
+
   p->sendfd = fd[1];
   p->recvfd = fd[0];
+
+  /* 
+   *  Make the pipe nonblocking so we don't block when too many
+   *  messages are sent while the other end of the pipe waits for the
+   *  test to exit (see bug #482012).  This doesn't solve our problem,
+   *  but it makes it more obvious what is happening since instead of
+   *  blocking the test exits with "Resource temporarily unavailable".
+   */
+  fcntl (p->sendfd, F_SETFL, O_NONBLOCK);
 }
-      
+
 void setup_messaging_with_key (MsgKey *key)
 {
   PipeEntry *pe;