diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-01-14 14:16:51 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-01-14 14:16:51 (GMT) |
commit | 582c4b826c90acc0c55d36b72802ee875ba9a7f4 (patch) | |
tree | 7f9d20aefbde66ed75c724de139652dae82026f8 /generic/tclFCmd.c | |
parent | 7558ac7276f0ee10f5beb26fe368eea7cbdb9e37 (diff) | |
download | tcl-582c4b826c90acc0c55d36b72802ee875ba9a7f4.zip tcl-582c4b826c90acc0c55d36b72802ee875ba9a7f4.tar.gz tcl-582c4b826c90acc0c55d36b72802ee875ba9a7f4.tar.bz2 |
Stop reliance on absolute attribute indexes with helper function [Bug 1100671]
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 } |