diff options
Diffstat (limited to 'win/tclWinFCmd.c')
| -rw-r--r-- | win/tclWinFCmd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 01af950..c3ced34 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -337,7 +337,7 @@ DoRenameFile( * character is either end-of-string or a directory separator */ - if ((strncmp(src, dst, (size_t) Tcl_DStringLength(&srcString))==0) + if ((strncmp(src, dst, Tcl_DStringLength(&srcString))==0) && (dst[Tcl_DStringLength(&srcString)] == '\\' || dst[Tcl_DStringLength(&srcString)] == '/' || dst[Tcl_DStringLength(&srcString)] == '\0')) { @@ -1026,7 +1026,8 @@ DoRemoveJustDirectory( if (nativePath == NULL || nativePath[0] == '\0') { Tcl_SetErrno(ENOENT); - goto end; + Tcl_DStringInit(errorPtr); + return TCL_ERROR; } attr = GetFileAttributes(nativePath); @@ -1108,9 +1109,7 @@ DoRemoveJustDirectory( end: if (errorPtr != NULL) { - char *p; - Tcl_WinTCharToUtf(nativePath, -1, errorPtr); - p = Tcl_DStringValue(errorPtr); + char *p = Tcl_WinTCharToUtf(nativePath, -1, errorPtr); for (; *p; ++p) { if (*p == '\\') *p = '/'; } @@ -1611,13 +1610,11 @@ ConvertFileNameFormat( for (i = 0; i < pathc; i++) { Tcl_Obj *elt; char *pathv; - size_t pathLen; Tcl_ListObjIndex(NULL, splitPath, i, &elt); pathv = TclGetString(elt); - pathLen = elt->length; - if ((pathv[0] == '/') || ((pathLen == 3) && (pathv[1] == ':')) + if ((pathv[0] == '/') || ((elt->length == 3) && (pathv[1] == ':')) || (strcmp(pathv, ".") == 0) || (strcmp(pathv, "..") == 0)) { /* * Handle "/", "//machine/export", "c:/", "." or ".." by just @@ -1652,7 +1649,6 @@ ConvertFileNameFormat( * likely to lead to infinite loops. */ - Tcl_DStringInit(&ds); tempString = TclGetString(tempPath); nativeName = Tcl_WinUtfToTChar(tempString, tempPath->length, &ds); Tcl_DecrRefCount(tempPath); |
