diff options
author | vincentdarley <vincentdarley> | 2003-10-03 17:45:36 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2003-10-03 17:45:36 (GMT) |
commit | 961ab79192fe2d6378d8903dca25ceaa6d4a97b8 (patch) | |
tree | 60e58def2b9c6ca8559eb36ce4d18dcb276d6fe3 /unix | |
parent | 5e610d838ab3c6b8398b2ae540ca3d73f2025e8a (diff) | |
download | tcl-961ab79192fe2d6378d8903dca25ceaa6d4a97b8.zip tcl-961ab79192fe2d6378d8903dca25ceaa6d4a97b8.tar.gz tcl-961ab79192fe2d6378d8903dca25ceaa6d4a97b8.tar.bz2 |
backporting of filesystem tests, docs
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixFCmd.c | 24 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 13 |
2 files changed, 28 insertions, 9 deletions
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 72f6846..a439511 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFCmd.c,v 1.28.2.1 2003/07/16 15:28:30 dgp Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.28.2.2 2003/10/03 17:45:37 vincentdarley Exp $ * * Portions of this code were derived from NetBSD source code which has * the following copyright notice: @@ -624,13 +624,22 @@ TclpObjCopyDirectory(srcPathPtr, destPathPtr, errorPtr) Tcl_DString ds; Tcl_DString srcString, dstString; int ret; - + Tcl_Obj *transPtr; + + transPtr = Tcl_FSGetTranslatedPath(NULL,srcPathPtr); Tcl_UtfToExternalDString(NULL, - Tcl_FSGetTranslatedStringPath(NULL,srcPathPtr), + (transPtr != NULL ? Tcl_GetString(transPtr) : NULL), -1, &srcString); + if (transPtr != NULL) { + Tcl_DecrRefCount(transPtr); + } + transPtr = Tcl_FSGetTranslatedPath(NULL,destPathPtr); Tcl_UtfToExternalDString(NULL, - Tcl_FSGetTranslatedStringPath(NULL,destPathPtr), + (transPtr != NULL ? Tcl_GetString(transPtr) : NULL), -1, &dstString); + if (transPtr != NULL) { + Tcl_DecrRefCount(transPtr); + } ret = TraverseUnixTree(TraversalCopy, &srcString, &dstString, &ds); @@ -681,9 +690,14 @@ TclpObjRemoveDirectory(pathPtr, recursive, errorPtr) Tcl_DString ds; Tcl_DString pathString; int ret; + Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr); - Tcl_UtfToExternalDString(NULL, Tcl_FSGetTranslatedStringPath(NULL, pathPtr), + Tcl_UtfToExternalDString(NULL, + (transPtr != NULL ? Tcl_GetString(transPtr) : NULL), -1, &pathString); + if (transPtr != NULL) { + Tcl_DecrRefCount(transPtr); + } ret = DoRemoveDirectory(&pathString, recursive, &ds); Tcl_DStringFree(&pathString); diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 3e74d16..fe9f067 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFile.c,v 1.32 2003/02/12 18:57:52 vincentdarley Exp $ + * RCS: @(#) $Id: tclUnixFile.c,v 1.32.2.1 2003/10/03 17:45:37 vincentdarley Exp $ */ #include "tclInt.h" @@ -255,7 +255,8 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) dirLength++; } } - + Tcl_DecrRefCount(fileNamePtr); + /* * Now open the directory for reading and iterate over the contents. */ @@ -745,10 +746,14 @@ TclpObjLink(pathPtr, toPtr, linkAction) char link[MAXPATHLEN]; int length; Tcl_DString ds; - - if (Tcl_FSGetTranslatedPath(NULL, pathPtr) == NULL) { + Tcl_Obj *transPtr; + + transPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr); + if (transPtr == NULL) { return NULL; } + Tcl_DecrRefCount(transPtr); + length = readlink(Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); if (length < 0) { return NULL; |