From 3e84d6e2157e1517c6903b9bc36bbf34e9d7b40d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Wed, 16 Apr 1997 16:04:52 -0700
Subject: [PATCH] bugfix for running configure remotely

Rev: src/configure.in:1.85
Rev: src/fd_control.c:1.7
---
 src/configure.in |  3 ++-
 src/fd_control.c | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/configure.in b/src/configure.in
index bfb05968ec..e81c3cc5f2 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-AC_REVISION("$Id: configure.in,v 1.84 1997/04/16 03:09:10 hubbe Exp $")
+AC_REVISION("$Id: configure.in,v 1.85 1997/04/16 23:04:51 hubbe Exp $")
 AC_INIT(interpret.c)
 AC_CONFIG_HEADER(machine.h)
 
@@ -668,6 +668,7 @@ AC_CHECK_FUNCS(
  dlsym \
  dld_link \
  dld_get_func \
+ pipe \
 )
 
 if test $ac_cv_func_crypt$ac_cv_func__crypt = nono ; then
diff --git a/src/fd_control.c b/src/fd_control.c
index 52e3b87152..c5faa6f1a2 100644
--- a/src/fd_control.c
+++ b/src/fd_control.c
@@ -92,6 +92,9 @@ int set_close_on_exec(int fd, int which)
 #ifdef TESTING
 
 #include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 /* a part of the autoconf thingy */
 
 RETSIGTYPE sigalrm_handler0(int tmp) { exit(0); }
@@ -99,15 +102,23 @@ RETSIGTYPE sigalrm_handler1(int tmp) { exit(1); }
 
 main()
 {
+  int tmp[2];
   char foo[1000];
-  set_nonblocking(0,1);
+
+  tmp[0]=0;
+  tmp[1]=0;
+#ifdef HAVE_PIPE
+  pipe(tmp);
+#endif
+  
+  set_nonblocking(tmp[0],1);
   signal(SIGALRM, sigalrm_handler1);
   alarm(1);
-  read(0,foo,999);
-  set_nonblocking(0,0);
+  read(tmp[0],foo,999);
+  set_nonblocking(tmp[0],0);
   signal(SIGALRM, sigalrm_handler0);
   alarm(1);
-  read(0,foo,999);
+  read(tmp[0],foo,999);
   exit(1);
 }
 #endif
-- 
GitLab