Subject: [3613567]: Corrected sense of test on results of access() in temp file creation.

From: dkf <[email-masked]>
Date: Mon, 20 May 2013 14:17:06 +0000

---
 ChangeLog          | 5 +++++
 unix/tclUnixFCmd.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b10acb6..ee43bb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-20  Donal K. Fellows  <[email-masked]>
+
+	* unix/tclUnixFCmd.c (DefaultTempDir): [Bug 3613567]: Corrected logic
+	for checking return code of access() system call, which was inverted.
+
 2013-05-19  Jan Nijtmans  <[email-masked]>
 
 	* unix/tcl.m4:     Fix for FreeBSD, and remove support for older
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 6f443a9..e27f78f 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -2226,13 +2226,13 @@ DefaultTempDir(void)
 
     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
-- 
cgit v0.12