diff options
author | Christopher Faylor <me@cgf.cx> | 2002-10-08 00:06:16 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-10-08 00:06:16 +0400 |
commit | dd76747b8e7892a8a17be9149c600561f518399a (patch) | |
tree | 52cfc9ca165345eb291c6519c65dbbd882696d54 /winsup | |
parent | 0709b9ba168f0562c7d01b08ec44849658212ff8 (diff) |
* 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.
(handle_to_fn): Return unknown_file when can't determine filename.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 14 | ||||
-rw-r--r-- | winsup/cygwin/resource.cc | 3 |
3 files changed, 16 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9c2de0c8d..175136eef 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,12 @@ 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. + (handle_to_fn): Return unknown_file when can't determine filename. + +2002-10-07 Christopher Faylor <cgf@redhat.com> + * dcrt0.cc (do_exit): Call DisableThreadLibraryCalls since we don't need to track thread detaches. * init.cc (dll_entry): Reorganize slightly. Fix api_fatal message. diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 4f2b544a6..064fe69bf 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -36,7 +36,9 @@ details. */ static const NO_COPY DWORD std_consts[] = {STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE}; -static char *handle_to_fn (HANDLE, char *); +static const char *handle_to_fn (HANDLE, char *); + +static const char NO_COPY unknown_file[] = "some disk file"; /* Set aside space for the table of fds */ void @@ -265,8 +267,8 @@ 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, - pc.binmode ()); + build_fhandler_from_name (fd, name, handle, pc) + ->init (handle, myaccess, (name == unknown_file) ? 0 : pc.binmode ()); set_std_handle (fd); paranoid_printf ("fd %d, handle %p", fd, handle); } @@ -695,7 +697,7 @@ dtable::vfork_child_fixup () #define REMOTE "\\Device\\LanmanRedirector\\" #define REMOTE_LEN sizeof (REMOTE) - 1 -static char * +static const char * handle_to_fn (HANDLE h, char *posix_fn) { OBJECT_NAME_INFORMATION *ntfn; @@ -710,9 +712,9 @@ handle_to_fn (HANDLE h, char *posix_fn) if (res) { - strcpy (posix_fn, "some disk file"); + strcpy (posix_fn, unknown_file); debug_printf ("NtQueryObject failed"); - return posix_fn; + return unknown_file; } // NT seems to do this on an unopened file diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 0db6cd5b8..01e065bb5 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -83,8 +83,7 @@ fill_rusage (struct rusage *r, HANDLE h) } } -extern "C" -int +extern "C" int getrusage (int intwho, struct rusage *rusage_in) { int res = 0; |