Eric Blake wrote:
> Also, should we offer O_BINARY/O_TEXT support on
> cygwin, using setmode()?  (On Linux, O_BINARY and O_TEXT are both 0, so we
> have implicitly already done so).

After 1 sec of thinking, yes. There is no reason to offer O_BINARY, O_TEXT in
accept4 but not in pipe2. Committed:


2009-08-23  Bruno Haible  <[email protected]>

        * lib/pipe2.c (pipe2): Support O_TEXT, O_BINARY on all platforms.
        Reported by Eric Blake.

--- lib/pipe2.c.orig    2009-08-23 10:45:28.000000000 +0200
+++ lib/pipe2.c 2009-08-23 10:37:41.000000000 +0200
@@ -52,7 +52,7 @@
 pipe2 (int fd[2], int flags)
 {
   /* Check the supported flags.  */
-  if ((flags & ~(O_CLOEXEC | O_NONBLOCK)) != 0)
+  if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0)
     {
       errno = EINVAL;
       return -1;
@@ -87,6 +87,13 @@
        goto fail;
     }
 
+#if O_BINARY
+  if (flags & O_BINARY)
+    setmode (fd, O_BINARY);
+  else if (flags & O_TEXT)
+    setmode (fd, O_TEXT);
+#endif
+
   return 0;
 
  fail:


Reply via email to