summaryrefslogtreecommitdiffstats
path: root/generic/tclFCmd.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2004-01-29 10:28:18 (GMT)
committervincentdarley <vincentdarley>2004-01-29 10:28:18 (GMT)
commitf5c319ed1e839e9256fcad85b69c4fde1d5d7c97 (patch)
treebc4f25a47a8614d6ef6beed61ae233eb487c80df /generic/tclFCmd.c
parent6d7cd4ec5de7d8e50e829fb37492ab7ca3a2f43a (diff)
downloadtcl-f5c319ed1e839e9256fcad85b69c4fde1d5d7c97.zip
tcl-f5c319ed1e839e9256fcad85b69c4fde1d5d7c97.tar.gz
tcl-f5c319ed1e839e9256fcad85b69c4fde1d5d7c97.tar.bz2
filesystem fixes for '-force' consistency and picky compilers
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r--generic/tclFCmd.c18
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) {