summaryrefslogtreecommitdiff
path: root/devel/ddd/files/patch-ddd-TTYAgent.C
blob: 8c4dac6d75a4b2004ed4a7150c890796b89f1d7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- ddd/TTYAgent.C.orig	2009-02-11 12:25:07.000000000 -0500
+++ ddd/TTYAgent.C	2009-08-22 23:43:03.712807083 -0400
@@ -280,7 +280,9 @@
 #if !defined(__osf__) && \
     HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_IOCTL
 #define HAVE_UNIX98PTYS 1
+#if !defined(__FreeBSD__)
 #define HAVE_STREAMS_IMPLEMENTATION 1
+#endif
 // FIXME: We should have a proper test for this.
 // For instance, GNU libc 2.1 on Linux (and probably HURD too) has UNIX98-style
 // pty allocation functions, but does not have a STREAMS-based implementation.
@@ -715,8 +717,19 @@
     }
     else
     {
+#if !defined(__FreeBSD__)
 	if (fcntl(master, F_SETFL, flags | O_NONBLOCK) == -1)
 	    _raiseIOWarning("cannot set file to non-blocking mode");
+#else
+    do {
+        if(fcntl(master, F_SETFL, flags | O_NONBLOCK) != -1)
+            break;
+        else if(errno == EAGAIN)
+            sleep(1);
+        else
+            _raiseIOWarning("cannot set file to non-blocking mode");
+    } while(errno == EAGAIN);
+#endif
     }
 #endif