Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-08 06:44:35 +0400
committerChristopher Faylor <me@cgf.cx>2002-10-08 06:44:35 +0400
commit9655ff2680dc416225d4297a5540dd79a156206a (patch)
tree9f04e967c305fcee27b5bedd308e3372c042b758
parentd389acbabf615d25eff5940d75fd43221597b039 (diff)
* dtable.cc (dtable::init_std_file_from_handle): Try to mimic standard open
behavior with files redirected from stdin/stdout/stderr, i.e., fmode settings take precedence over mount settings.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/dtable.cc9
2 files changed, 13 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 175136eef..67ce476f6 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2002-10-07 Christopher Faylor <cgf@redhat.com>
+ * dtable.cc (dtable::init_std_file_from_handle): Try to mimic standard
+ open behavior with files redirected from stdin/stdout/stderr, i.e.,
+ fmode settings take precedence over mount settings.
+
+2002-10-07 Christopher Faylor <cgf@redhat.com>
+
* dtable.cc (unknown_file): New variable.
(dtable::init_std_file_from_handle): Don't set binmode if we couldn't
determine the actual file name on stdin/stdout/stderr.
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 064fe69bf..d18f99b6b 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -267,8 +267,13 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle, DWORD myaccess)
else
{
path_conv pc;
- build_fhandler_from_name (fd, name, handle, pc)
- ->init (handle, myaccess, (name == unknown_file) ? 0 : pc.binmode ());
+ unsigned bin;
+ fhandler_base *fh = build_fhandler_from_name (fd, name, handle, pc);
+ bin = fh->get_default_fmode (myaccess == GENERIC_READ ? O_RDONLY : O_WRONLY);
+ if (!bin && name != unknown_file)
+ bin = pc.binmode ();
+
+ fh->init (handle, myaccess, bin);
set_std_handle (fd);
paranoid_printf ("fd %d, handle %p", fd, handle);
}