diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | 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,5 +1,11 @@ 2002-06-19 Christopher Faylor <cgf@redhat.com> + * 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 <cgf@redhat.com> + Use hMainProc where appropriate, throughout. * environ.cc (spenv::retrieve): Add debugging statements. 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 |