Mercurial > hg > octave-kai > gnulib-hg
changeset 11880:d5e0338c205a
Support O_TEXT, O_BINARY on all platforms.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 23 Aug 2009 10:46:39 +0200 |
parents | bd0609bf2760 |
children | 9e30ae0c65a0 |
files | ChangeLog lib/pipe2.c |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ +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>
--- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -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: