diff options
author | Christopher Faylor <me@cgf.cx> | 2002-06-01 00:48:14 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-06-01 00:48:14 +0400 |
commit | 8461f41ec0fee805e963e5da65ebfae302fac331 (patch) | |
tree | 41f22fb50e9fea14b9768bfd85ff9713cc860f6b /winsup | |
parent | bcd0ed9f6a107505af309ff8f94ff43859f07e3d (diff) |
* fhandler.cc (fhandler_base::open): Make default open mode == binmode.
(fhandler_base::init): Set open flags based on derived binmode argument.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a40a17bf6..377231899 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 2002-05-31 Christopher Faylor <cgf@redhat.com> + * fhandler.cc (fhandler_base::open): Make default open mode == binmode. + (fhandler_base::init): Set open flags based on derived binmode argument. + +2002-05-31 Christopher Faylor <cgf@redhat.com> + * dll_init.cc (dll_list::init): Eliminate unneeded debugging statement. 2002-05-31 Christopher Faylor <cgf@redhat.com> diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 756a74804..00a8e0b0b 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -434,9 +434,9 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode) else if (fmode & O_TEXT) bin = O_TEXT; else if (get_device () == FH_DISK) - bin = get_w_binary () || get_r_binary () || O_BINARY; + bin = get_w_binary () || get_r_binary () || 1; else - bin = (binmode == O_BINARY) || get_w_binary () || get_r_binary (); + bin = get_w_binary () || get_r_binary () || (binmode != O_TEXT); if (bin & O_TEXT) bin = 0; @@ -853,12 +853,14 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin) set_w_binary (bin); access = a; a &= GENERIC_READ | GENERIC_WRITE; + int oflags = 0; if (a == GENERIC_READ) - set_flags (O_RDONLY); - if (a == GENERIC_WRITE) - set_flags (O_WRONLY); - if (a == (GENERIC_READ | GENERIC_WRITE)) - set_flags (O_RDWR); + oflags = O_RDONLY; + else if (a == GENERIC_WRITE) + oflags = O_WRONLY; + else if (a == (GENERIC_READ | GENERIC_WRITE)) + oflags = O_RDWR; + set_flags (oflags | (bin ? O_BINARY : O_TEXT)); set_open_status (); debug_printf ("created new fhandler_base for handle %p", f); } |