diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-02-15 20:11:36 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-02-15 20:11:36 +0400 |
commit | 5e7c84e55435ce810e3588916fe12455e42ae6e4 (patch) | |
tree | 0e5dbae77a7e38adaae19c48a75e95a947b04615 /winsup/cygwin/dtable.cc | |
parent | a0f4e7d3f19f5e7b5e3cab2f18790fcda4dae991 (diff) |
* dtable.cc (dtable::init_std_file_from_handle): Use tmp_pathbuf for
name.
(handle_to_fn): Ditto for device. Fix size in QueryDosDeviceW call.
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r-- | winsup/cygwin/dtable.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index e06936c6a..612506e0c 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -262,6 +262,7 @@ cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin, void dtable::init_std_file_from_handle (int fd, HANDLE handle) { + tmp_pathbuf tp; CONSOLE_SCREEN_BUFFER_INFO buf; DCB dcb; unsigned bin = O_BINARY; @@ -275,7 +276,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) SetLastError (0); DWORD access = 0; DWORD ft = GetFileType (handle); - char name[NT_MAX_PATH]; + char *name = tp.c_get (); name[0] = '\0'; if (ft == FILE_TYPE_UNKNOWN && GetLastError () == ERROR_INVALID_HANDLE) /* can't figure out what this is */; @@ -889,6 +890,7 @@ handle_to_fn (HANDLE h, char *posix_fn) tmp_pathbuf tp; ULONG len = 0; WCHAR *maxmatchdos = NULL; + PWCHAR device = tp.w_get (); int maxmatchlen = 0; OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) tp.w_get (); @@ -949,8 +951,7 @@ handle_to_fn (HANDLE h, char *posix_fn) for (WCHAR *s = fnbuf; *s; s = wcschr (s, '\0') + 1) { - WCHAR device[NT_MAX_PATH]; - if (!QueryDosDeviceW (s, device, sizeof (device))) + if (!QueryDosDeviceW (s, device, NT_MAX_PATH)) continue; if (wcschr (s, ':') == NULL) continue; |