diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-10-31 10:20:03 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-10-31 10:20:03 (GMT) |
commit | 2d1631b0f035c1c171f4876d584af1fe60ca676c (patch) | |
tree | 57a471ca60fa411a34c007f4977d04e535b11df5 /win/tclWinFile.c | |
parent | f638baa7b26cb01687d4155daaa9173ddea01a4a (diff) | |
parent | f6161cafab22785e5a346b26bd0ef59cdb950c57 (diff) | |
download | tcl-2d1631b0f035c1c171f4876d584af1fe60ca676c.zip tcl-2d1631b0f035c1c171f4876d584af1fe60ca676c.tar.gz tcl-2d1631b0f035c1c171f4876d584af1fe60ca676c.tar.bz2 |
When translating a reserved devicename to native pathname, strip ':' postfix. Possible fix for [dcc03414f5], but anyway a good idea.
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r-- | win/tclWinFile.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index fe84a26..844eb9e 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -2933,11 +2933,15 @@ TclNativeCreateNativeRep( /* String contains NUL-bytes. This is invalid. */ return 0; } - /* Let MultiByteToWideChar check for other invalid sequences, like - * 0xC0 0x80 (== overlong NUL). See bug [3118489]: NUL in filenames */ - len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, 0, 0); - if (len==0) { - return 0; + /* For a reserved device, strip a possible postfix ':' */ + len = WinIsReserved(str); + if (len == 0) { + /* Let MultiByteToWideChar check for other invalid sequences, like + * 0xC0 0x80 (== overlong NUL). See bug [3118489]: NUL in filenames */ + len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, 0, 0); + if (len==0) { + return 0; + } } /* Overallocate 6 chars, making some room for extended paths */ wp = nativePathPtr = ckalloc( (len+6) * sizeof(WCHAR) ); |