summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorandreask <andreask>2014-11-06 18:38:36 (GMT)
committerandreask <andreask>2014-11-06 18:38:36 (GMT)
commit6e42c4bf10f4e275c5ae106296110a3584b4a070 (patch)
treec8ac936da5fd2bc1d67b309ab88bd64ee0ef1609 /win
parente35f1f6d7d8f8e1bc59318735e23b34ab06d8f54 (diff)
parentf033a745db5e733d99ebc0a7895320435de1bd82 (diff)
downloadtcl-6e42c4bf10f4e275c5ae106296110a3584b4a070.zip
tcl-6e42c4bf10f4e275c5ae106296110a3584b4a070.tar.gz
tcl-6e42c4bf10f4e275c5ae106296110a3584b4a070.tar.bz2
Merged latest trunk work (especially changes to eof handling) into the RC.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinChan.c5
-rw-r--r--win/tclWinFile.c20
2 files changed, 17 insertions, 8 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 48acacb..2d6c42c 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -843,6 +843,11 @@ TclpOpenFileChannel(
nativeName = Tcl_FSGetNativePath(pathPtr);
if (nativeName == NULL) {
+ if (interp != (Tcl_Interp *) NULL) {
+ Tcl_AppendResult(interp, "couldn't open \"",
+ TclGetString(pathPtr), "\": filename is invalid on this platform",
+ NULL);
+ }
return NULL;
}
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index fe84a26..4cd042a 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1241,9 +1241,9 @@ WinIsReserved(
if ((path[0] == 'c' || path[0] == 'C')
&& (path[1] == 'o' || path[1] == 'O')) {
if ((path[2] == 'm' || path[2] == 'M')
- && path[3] >= '1' && path[3] <= '4') {
+ && path[3] >= '1' && path[3] <= '9') {
/*
- * May have match for 'com[1-4]:?', which is a serial port.
+ * May have match for 'com[1-9]:?', which is a serial port.
*/
if (path[4] == '\0') {
@@ -2933,18 +2933,22 @@ 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) );
if (nativePathPtr==0) {
return 0;
}
- MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, len);
+ MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nativePathPtr, len+1);
/*
** If path starts with "//?/" or "\\?\" (extended path), translate
** any slashes to backslashes but leave the '?' intact