diff -uNr tcl8.6.0.orig/unix/tclUnixFCmd.c tcl8.6.0-bug3613567-1tmpdirfix/unix/tclUnixFCmd.c
--- tcl8.6.0.orig/unix/tclUnixFCmd.c 2012-11-14 11:19:08.000000000 -0600
+++ tcl8.6.0-bug3613567-1tmpdirfix/unix/tclUnixFCmd.c 2013-05-18 13:34:13.591452500 -0500
@@ -2226,13 +2226,13 @@
dir = getenv("TMPDIR");
if (dir && dir[0] && stat(dir, &buf) == 0 && S_ISDIR(buf.st_mode)
- && access(dir, W_OK)) {
+ && access(dir, W_OK) == 0) {
return dir;
}
#ifdef P_tmpdir
dir = P_tmpdir;
- if (stat(dir, &buf) == 0 && S_ISDIR(buf.st_mode) && access(dir, W_OK)) {
+ if (stat(dir, &buf) == 0 && S_ISDIR(buf.st_mode) && access(dir, W_OK) == 0) {
return dir;
}
#endif