summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-02-15 16:11:36 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-02-15 16:11:36 +0000
commit5e7c84e55435ce810e3588916fe12455e42ae6e4 (patch)
tree0e5dbae77a7e38adaae19c48a75e95a947b04615
parenta0f4e7d3f19f5e7b5e3cab2f18790fcda4dae991 (diff)
downloadcygnal-5e7c84e55435ce810e3588916fe12455e42ae6e4.tar.gz
cygnal-5e7c84e55435ce810e3588916fe12455e42ae6e4.tar.bz2
cygnal-5e7c84e55435ce810e3588916fe12455e42ae6e4.zip
* dtable.cc (dtable::init_std_file_from_handle): Use tmp_pathbuf for
name. (handle_to_fn): Ditto for device. Fix size in QueryDosDeviceW call.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/dtable.cc7
2 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9a48b097d..94615cffb 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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,
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;