diff options
author | Christopher Faylor <me@cgf.cx> | 2001-04-23 17:29:33 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-04-23 17:29:33 +0000 |
commit | 9cf9c146685aaf111b9bf267db771d8905072deb (patch) | |
tree | b12482f70700d082052d167f5c82a9f7b61be706 /winsup/cygwin/syscalls.cc | |
parent | ca608f5682e66012bf82a0f37a702bf549f10e6c (diff) | |
download | cygnal-9cf9c146685aaf111b9bf267db771d8905072deb.tar.gz cygnal-9cf9c146685aaf111b9bf267db771d8905072deb.tar.bz2 cygnal-9cf9c146685aaf111b9bf267db771d8905072deb.zip |
* fhandler.h (fhandler_base::clear_r_binary): New method.
(fhandler_base::clear_w_binary): New method.
* syscalls.cc (setmode): Accept 0 as mode value. Resets text/binary behavior
for fd to default.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 4e862a21f..3211ab934 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1646,19 +1646,26 @@ setmode (int fd, int mode) int res; if (p->get_w_binary () && p->get_r_binary ()) res = O_BINARY; + else if (p->get_w_binset () && p->get_r_binset ()) + res = O_TEXT; /* Specifically set O_TEXT */ else - res = O_TEXT; + res = 0; if (mode & O_BINARY) { p->set_w_binary (1); p->set_r_binary (1); } - else + else if (mode & O_TEXT) { p->set_w_binary (0); p->set_r_binary (0); } + else + { + p->clear_w_binary (); + p->clear_r_binary (); + } if (_cygwin_istext_for_stdio (fd)) setmode_mode = O_TEXT; |