summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-05-20 14:17:06 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-05-20 14:17:06 (GMT)
commit0eb5b1db67343f2a0f3ca3acaf567db4f3c7b9cf (patch)
treeae68a7200e4642710c6f9baaa55700958b00c760
parent5ed45c8735ed45385180fdf76546bf0dfacb6cd5 (diff)
downloadtcl-0eb5b1db67343f2a0f3ca3acaf567db4f3c7b9cf.zip
tcl-0eb5b1db67343f2a0f3ca3acaf567db4f3c7b9cf.tar.gz
tcl-0eb5b1db67343f2a0f3ca3acaf567db4f3c7b9cf.tar.bz2
[3613567]: Corrected sense of test on results of access() in temp file creation.
-rw-r--r--ChangeLog5
-rw-r--r--unix/tclUnixFCmd.c4
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 <dkf@users.sf.net>
+
+ * unix/tclUnixFCmd.c (DefaultTempDir): [Bug 3613567]: Corrected logic
+ for checking return code of access() system call, which was inverted.
+
2013-05-19 Jan Nijtmans <nijtmans@users.sf.net>
* 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