summaryrefslogtreecommitdiffstats
path: root/macosx/tclMacOSXFCmd.c
diff options
context:
space:
mode:
authordas <das>2007-01-19 01:03:58 (GMT)
committerdas <das>2007-01-19 01:03:58 (GMT)
commit34a3970c39dead78485d1bd7b7f4b858922c8f69 (patch)
tree8c889dd8b584c804f47a564d9fc3ed74243866d6 /macosx/tclMacOSXFCmd.c
parent79321316d659aa0a2e5790798db88d38b8a9a835 (diff)
downloadtcl-34a3970c39dead78485d1bd7b7f4b858922c8f69.zip
tcl-34a3970c39dead78485d1bd7b7f4b858922c8f69.tar.gz
tcl-34a3970c39dead78485d1bd7b7f4b858922c8f69.tar.bz2
* macosx/tclMacOSXFCmd.c (TclMacOSXSetFileAttribute): on some versions
of Mac OS X, truncate() fails on resource forks, in that case use open() with O_TRUNC instead. * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of OSSpinLock(Un)Lock API. * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running testsuite from Xcode. * tests/env.test: add extra system env vars that need to be preserved on some Mac OS X versions for testsuite to work. * unix/Makefile.in: move libtommath defines into configure.in to avoid * unix/configure.in: replicating them across multiple buildsystems. * macosx/Tcl.xcodeproj/project.pbxproj: * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when present in CFLAGS to avoid discrepancies between what headers configure sees during preprocessing tests and compiling tests. * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59
Diffstat (limited to 'macosx/tclMacOSXFCmd.c')
-rw-r--r--macosx/tclMacOSXFCmd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index 65352c2..6b32726 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.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: tclMacOSXFCmd.c,v 1.10 2006/08/18 07:45:31 das Exp $
+ * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.11 2007/01/19 01:03:59 das Exp $
*/
#include "tclInt.h"
@@ -333,6 +333,17 @@ TclMacOSXSetFileAttribute(
Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1);
result = truncate(Tcl_DStringValue(&ds), (off_t)0);
+ if (result != 0) {
+ /*
+ * truncate() on a valid resource fork path may fail with
+ * a permission error in some OS releases, try truncating
+ * with open() instead:
+ */
+ int fd = open(Tcl_DStringValue(&ds), O_WRONLY | O_TRUNC);
+ if (fd > 0) {
+ result = close(fd);
+ }
+ }
Tcl_DStringFree(&ds);