diff options
author | dkf <dkf@noemail.net> | 2005-01-14 14:16:51 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2005-01-14 14:16:51 (GMT) |
commit | 81de02219192f45ee8a3258c39b4fa15b7416dfc (patch) | |
tree | 7f9d20aefbde66ed75c724de139652dae82026f8 /generic/tclFCmd.c | |
parent | 5d78935983e01c4919819cd6459cf7254bd6bb13 (diff) | |
download | tcl-81de02219192f45ee8a3258c39b4fa15b7416dfc.zip tcl-81de02219192f45ee8a3258c39b4fa15b7416dfc.tar.gz tcl-81de02219192f45ee8a3258c39b4fa15b7416dfc.tar.bz2 |
Stop reliance on absolute attribute indexes with helper function [Bug 1100671]
FossilOrigin-Name: 7612557f3c34665586acdce39a375e383211ca5d
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r-- | generic/tclFCmd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index a74b6d6..9eb4685 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.29 2004/10/19 21:54:07 dgp Exp $ + * RCS: @(#) $Id: tclFCmd.c,v 1.30 2005/01/14 14:16:53 dkf Exp $ */ #include "tclInt.h" @@ -534,10 +534,13 @@ CopyRenameOneFile(interp, source, target, copyFlag, force) */ #if !defined(__WIN32__) { - Tcl_Obj* perm = Tcl_NewStringObj("u+w",-1); - Tcl_IncrRefCount(perm); - Tcl_FSFileAttrsSet(NULL, 2, target, perm); - Tcl_DecrRefCount(perm); + Tcl_Obj* perm = Tcl_NewStringObj("u+w",-1); + int index; + Tcl_IncrRefCount(perm); + if (TclFSFileAttrIndex(target, "-permissions", &index) == TCL_OK) { + Tcl_FSFileAttrsSet(NULL, index, target, perm); + } + Tcl_DecrRefCount(perm); } #endif } |