* dtable.cc (dtable::init_std_file_from_handle): Use tmp_pathbuf for

name.
	(handle_to_fn): Ditto for device.  Fix size in QueryDosDeviceW call.
This commit is contained in:
Corinna Vinschen 2012-02-15 16:11:36 +00:00
parent a0f4e7d3f1
commit 5e7c84e554
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2012-02-15 Corinna Vinschen <corinna@vinschen.de>
* dtable.cc (dtable::init_std_file_from_handle): Use tmp_pathbuf for
name.
(handle_to_fn): Ditto for device. Fix size in QueryDosDeviceW call.
2012-02-15 Christopher Faylor <me.cygwin2012@cgf.cx>
* smallprint.cc (tmpbuf): Declare new class holding a static buffer,

View File

@ -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;