From c25ebbaf55dbef934d85522616d898eef37438e4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 20 Jun 2002 00:36:40 +0000 Subject: [PATCH] * fhandler.cc (fhandler_base::set_flags): Change priority of "linked in" default binmode setting so that it has priority over optional setting. --- winsup/cygwin/ChangeLog | 6 +++++ winsup/cygwin/fhandler.cc | 55 ++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index caed2c3c3..037123ecd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2002-06-19 Christopher Faylor + + * fhandler.cc (fhandler_base::set_flags): Change priority of "linked + in" default binmode setting so that it has priority over optional + setting. + 2002-06-19 Christopher Faylor Use hMainProc where appropriate, throughout. 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 -- 2.43.5