diff options
author | Christopher Faylor <me@cgf.cx> | 2002-06-20 04:36:40 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-06-20 04:36:40 +0400 |
commit | c25ebbaf55dbef934d85522616d898eef37438e4 (patch) | |
tree | 12ae292f8269d280cf899aa60f05adcef774a009 /winsup/cygwin/fhandler.cc | |
parent | 6311ef857566bc9008450a8b8a851595b66abcb5 (diff) |
* fhandler.cc (fhandler_base::set_flags): Change priority of "linked in"
default binmode setting so that it has priority over optional setting.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 1ccc93d7e..04156c47c 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -57,33 +57,6 @@ fhandler_base::puts_readahead (const char *s, size_t len) return success; } -void -fhandler_base::set_flags (int flags, int supplied_bin) -{ - int bin; - int fmode; - debug_printf ("flags %p, supplied_bin %p", flags, supplied_bin); - if ((bin = flags & (O_BINARY | O_TEXT))) - debug_printf ("O_TEXT/O_BINARY set in flags %p", bin); - else if (get_r_binset () && get_w_binset ()) - bin = get_r_binary () ? O_BINARY : O_TEXT; // FIXME: Not quite right - else if (supplied_bin) - bin = supplied_bin; - else if ((fmode = get_default_fmode (flags)) & O_BINARY) - bin = O_BINARY; - else if (fmode & O_TEXT) - bin = O_TEXT; - else - bin = get_w_binary () || get_r_binary () || (binmode != O_TEXT) ? - O_BINARY : O_TEXT; - - openflags = flags | bin; - - set_r_binary (bin & O_BINARY); - set_w_binary (bin & O_BINARY); - syscall_printf ("filemode set to %s", bin ? "binary" : "text"); -} - int fhandler_base::put_readahead (char value) { @@ -243,6 +216,34 @@ is_at_eof (HANDLE h, DWORD err) return 0; } +void +fhandler_base::set_flags (int flags, int supplied_bin) +{ + int bin; + int fmode; + debug_printf ("flags %p, supplied_bin %p", flags, supplied_bin); + if ((bin = flags & (O_BINARY | O_TEXT))) + debug_printf ("O_TEXT/O_BINARY set in flags %p", bin); + else if (get_r_binset () && get_w_binset ()) + bin = get_r_binary () ? O_BINARY : O_TEXT; // FIXME: Not quite right + else if ((fmode = get_default_fmode (flags)) & O_BINARY) + bin = O_BINARY; + else if (fmode & O_TEXT) + bin = O_TEXT; + else if (supplied_bin) + bin = supplied_bin; + else + bin = get_w_binary () || get_r_binary () || (binmode != O_TEXT) ? + O_BINARY : O_TEXT; + + openflags = flags | bin; + + bin &= O_BINARY; + set_r_binary (bin); + set_w_binary (bin); + syscall_printf ("filemode set to %s", bin ? "binary" : "text"); +} + /* Normal file i/o handlers. */ /* Cover function to ReadFile to achieve (as much as possible) Posix style |