diff options
author | Christopher Faylor <me@cgf.cx> | 2002-06-04 05:40:53 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-06-04 05:40:53 +0400 |
commit | e02f1e9c81debf68a7948ffbd3f8177e0ec0fc59 (patch) | |
tree | 2191ccba1a3b2b3ab5731d6a33011b3d953a4d40 /winsup | |
parent | e6cd2312d62bc34e430b74e34c2223f38eebe2f3 (diff) |
* fhandler.cc (fhandler_base::open): Don't set binmode if already set. Don't
check for file. Files should already be set. Report on binary mode for
debugging.
(fhandler_base::fhandler_base): Don't set default binmode here. That's for
later.
* fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set binmode,
ever, for console.
* fhandler_disk_file.cc (fhandler_disk_file::open): Always set the binary mode
to the value derived from mount table.
* path.cc (mount_info::conv_to_win32_path): Default to binmode if path does not
translate into anything in the mount table.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 14 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 41 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 2 |
5 files changed, 42 insertions, 24 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 54113f977..cd012c636 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,17 @@ +2002-06-03 Christopher Faylor <cgf@redhat.com> + + * fhandler.cc (fhandler_base::open): Don't set binmode if already set. + Don't check for file. Files should already be set. Report on binary + mode for debugging. + (fhandler_base::fhandler_base): Don't set default binmode here. That's + for later. + * fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set + binmode, ever, for console. + * fhandler_disk_file.cc (fhandler_disk_file::open): Always set the + binary mode to the value derived from mount table. + * path.cc (mount_info::conv_to_win32_path): Default to binmode if path + does not translate into anything in the mount table. + 2002-06-03 Corinna Vinschen <corinna@vinschen.de> * external.cc (cygwin_internal): Add CW_EXTRACT_DOMAIN_AND_USER diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 71860d2a3..820096bcc 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -424,27 +424,30 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode) set_file_attribute (has_acls (), get_win32_name (), mode); set_io_handle (x); - int bin; - int fmode; - if ((bin = flags & (O_BINARY | O_TEXT))) - /* nothing to do */; - else if ((fmode = get_default_fmode (flags)) & O_BINARY) - bin = O_BINARY; - else if (fmode & O_TEXT) - bin = O_TEXT; - else if (get_device () == FH_DISK) - bin = get_w_binary () || get_r_binary () || 1; + if (get_w_binset () && get_r_binset ()) + syscall_printf ("filemode already set to %d/%d", get_r_binary (), get_w_binary ()); else - bin = get_w_binary () || get_r_binary () || (binmode != O_TEXT); + { + int bin; + int fmode; + if ((bin = flags & (O_BINARY | O_TEXT))) + /* nothing to do */; + 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); - if (bin & O_TEXT) - bin = 0; + if (bin & O_TEXT) + bin = 0; - set_flags (flags | (bin ? O_BINARY : O_TEXT)); + set_flags (flags | (bin ? O_BINARY : O_TEXT)); - set_r_binary (bin); - set_w_binary (bin); - syscall_printf ("filemode set to %s", bin ? "binary" : "text"); + set_r_binary (bin); + set_w_binary (bin); + syscall_printf ("filemode set to %s", bin ? "binary" : "text"); + } res = 1; set_open_status (); @@ -859,7 +862,7 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin) oflags = O_RDWR; set_flags (oflags | (bin ? O_BINARY : O_TEXT)); set_open_status (); - debug_printf ("created new fhandler_base for handle %p", f); + debug_printf ("created new fhandler_base for handle %p, bin %d", f, get_r_binary ()); } void @@ -1019,6 +1022,7 @@ fhandler_base::fhandler_base (DWORD devtype, int unit): win32_path_name (NULL), open_status (0) { +#if 0 int bin = __fmode & O_TEXT ? 0 : 1; if (status != FH_DISK && status != FH_CONSOLE) { @@ -1027,6 +1031,7 @@ fhandler_base::fhandler_base (DWORD devtype, int unit): if (!get_w_binset ()) set_w_binary (bin); } +#endif } /* Normal I/O destructor */ diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index ac4f9ba68..64959e9ee 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -719,8 +719,10 @@ fhandler_console::output_tcsetattr (int, struct termios const *t) /* Ignore the optional_actions stuff, since all output is emitted instantly */ +#if 0 /* Enable/disable LF -> CRLF conversions */ set_w_binary ((t->c_oflag & ONLCR) ? 0 : 1); +#endif /* All the output bits we can ignore */ diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index c7c78ab34..167edf469 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -339,11 +339,8 @@ fhandler_disk_file::open (path_conv *real_path, int flags, mode_t mode) return 0; } - if (real_path->isbinary ()) - { - set_r_binary (1); - set_w_binary (1); - } + set_r_binary (real_path->isbinary ()); + set_w_binary (real_path->isbinary ()); set_has_acls (real_path->has_acls ()); set_isremote (real_path->isremote ()); diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 3b8a2d87a..e6a948382 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1508,7 +1508,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, if (i >= nmounts) { backslashify (pathbuf, dst, 0); /* just convert */ - *flags = 0; + *flags = PATH_BINARY; /* Default to binmode */ } else { |