summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/dcrt0.cc20
2 files changed, 17 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index dfe389736..8251cdcb4 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-02 Corinna Vinschen <corinna@vinschen.de>
+
+ * dcrt0.cc (insert_file): Convert filename to WCHAR and call
+ CreateFileW to allow UTF-8 filenames.
+
2008-04-01 Corinna Vinschen <corinna@vinschen.de>
* Fix copyright dates.
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 7461b04aa..cd2ac1eae 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -39,6 +39,7 @@ details. */
#include "sync.h"
#include "heap.h"
#include "environ.h"
+#include "tls_pbuf.h"
#define MAX_AT_FILE_LEVEL 10
@@ -161,14 +162,17 @@ insert_file (char *name, char *&cmd)
{
HANDLE f;
DWORD size;
-
- f = CreateFile (name + 1,
- GENERIC_READ, /* open for reading */
- FILE_SHARE_READ, /* share for reading */
- &sec_none_nih, /* no security */
- OPEN_EXISTING, /* existing file only */
- FILE_ATTRIBUTE_NORMAL, /* normal file */
- NULL); /* no attr. template */
+ tmp_pathbuf tp;
+
+ PWCHAR wname = tp.w_get ();
+ sys_mbstowcs (wname, NT_MAX_PATH + 1, name + 1);
+ f = CreateFileW (wname,
+ GENERIC_READ, /* open for reading */
+ FILE_SHARE_READ, /* share for reading */
+ &sec_none_nih, /* default security */
+ OPEN_EXISTING, /* existing file only */
+ FILE_ATTRIBUTE_NORMAL,/* normal file */
+ NULL); /* no attr. template */
if (f == INVALID_HANDLE_VALUE)
{