diff options
author | vincentdarley <vincentdarley@noemail.net> | 2004-01-29 10:28:17 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley@noemail.net> | 2004-01-29 10:28:17 (GMT) |
commit | 7d8f26303b37b580b38e0d8366c677a344e2adb2 (patch) | |
tree | bc4f25a47a8614d6ef6beed61ae233eb487c80df /generic/tclFCmd.c | |
parent | 67ea1692eb5e64a20344a399b09f1ca644892afd (diff) | |
download | tcl-7d8f26303b37b580b38e0d8366c677a344e2adb2.zip tcl-7d8f26303b37b580b38e0d8366c677a344e2adb2.tar.gz tcl-7d8f26303b37b580b38e0d8366c677a344e2adb2.tar.bz2 |
filesystem fixes for '-force' consistency and picky compilers
FossilOrigin-Name: fff97fe11686fd45ff17aebdd91fb6c89fd9498a
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r-- | generic/tclFCmd.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 3d78f4c..8cfcdf7 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.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: tclFCmd.c,v 1.23 2004/01/21 19:59:33 vincentdarley Exp $ + * RCS: @(#) $Id: tclFCmd.c,v 1.24 2004/01/29 10:28:20 vincentdarley Exp $ */ #include "tclInt.h" @@ -525,6 +525,22 @@ CopyRenameOneFile(interp, source, target, copyFlag, force) Tcl_GetString(source), "\"", (char *) NULL); goto done; } + + /* + * The destination exists, but appears to be ok to over-write, + * and -force is given. We now try to adjust permissions to + * ensure the operation succeeds. If we can't adjust + * permissions, we'll let the actual copy/rename return + * an error later. + */ +#if !defined(__WIN32__) && !defined(MAC_TCL) + { + Tcl_Obj* perm = Tcl_NewStringObj("u+w",-1); + Tcl_IncrRefCount(perm); + Tcl_FSFileAttrsSet(NULL, 2, target, perm); + Tcl_DecrRefCount(perm); + } +#endif } if (copyFlag == 0) { |