bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'pipe2'


From: Bruno Haible
Subject: Re: new module 'pipe2'
Date: Sun, 23 Aug 2009 10:48:10 +0200
User-agent: KMail/1.9.9

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  <address@hidden>

        * 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

[Prev in Thread] Current Thread [Next in Thread]