summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--tests/io.test8
-rw-r--r--win/tclWinFile.c6
3 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e430f32..97faf2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-11 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tclWinFile.c: [Bug 2935503] Incorrect mode field
+ * tests/io.test: returned by file stat command
+
2011-10-07 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tclIORChan.c: Fix gcc warning
diff --git a/tests/io.test b/tests/io.test
index 129d741..28e847e 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -5203,18 +5203,18 @@ test io-40.1 {POSIX open access modes: RDWR} {
close $f
set x
} {zzy abzzy}
-test io-40.2 {POSIX open access modes: CREAT} {unix} {
+test io-40.2 {POSIX open access modes: CREAT} {
file delete $path(test3)
- set f [open $path(test3) {WRONLY CREAT} 0600]
+ set f [open $path(test3) {WRONLY CREAT} 0o666]
file stat $path(test3) stats
- set x [format "0%o" [expr $stats(mode)&0o777]]
+ set x [format "0o%o" [expr $stats(mode)&0o777]]
puts $f "line 1"
close $f
set f [open $path(test3) r]
lappend x [gets $f]
close $f
set x
-} {0600 {line 1}}
+} {0o666 {line 1}}
test io-40.3 {POSIX open access modes: CREAT} {unix umask} {
# This test only works if your umask is 2, like ouster's.
file delete $path(test3)
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 0291a41..9c95e7a 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1281,7 +1281,7 @@ WinIsReserved(
* because for NTFS root volumes, the getFileAttributesProc returns a
* 'hidden' attribute when it should not.
*
- * We never make any calss to a 'get attributes' routine here, since we
+ * We never make any calls to a 'get attributes' routine here, since we
* have arranged things so that our caller already knows such
* information.
*
@@ -2265,8 +2265,8 @@ NativeStatMode(
* positions.
*/
- mode |= (mode & 0x0700) >> 3;
- mode |= (mode & 0x0700) >> 6;
+ mode |= (mode & (S_IREAD|S_IWRITE|S_IEXEC)) >> 3;
+ mode |= (mode & (S_IREAD|S_IWRITE|S_IEXEC)) >> 6;
return (unsigned short) mode;
}