Commit 1a661ca2 authored by Bruno Haible's avatar Bruno Haible
Browse files

Support O_TEXT, O_BINARY on all platforms.

parent 6ef5d068
2009-08-23 Bruno Haible <bruno@clisp.org>
* lib/pipe2.c (pipe2): Support O_TEXT, O_BINARY on all platforms.
Reported by Eric Blake.
2009-08-23 Bruno Haible <bruno@clisp.org>
 
* lib/pipe2.c (pipe2): Fix test of fcntl's return value.
Reported by Eric Blake.
 
2009-08-23 Bruno Haible <bruno@clisp.org>
 
......@@ -52,7 +52,7 @@ int
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 @@ pipe2 (int fd[2], int flags)
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:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment