summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhobbs <hobbs>2007-12-14 02:29:20 (GMT)
committerhobbs <hobbs>2007-12-14 02:29:20 (GMT)
commit1c95363481976a57b43d204d6f6d5e364bbb56b6 (patch)
tree32d0f03e9786e52c0c9bf57cd38840852676224c /tests
parent7579bff98894f7f03c12fae6ecbd01e473d06021 (diff)
downloadtcl-1c95363481976a57b43d204d6f6d5e364bbb56b6.zip
tcl-1c95363481976a57b43d204d6f6d5e364bbb56b6.tar.gz
tcl-1c95363481976a57b43d204d6f6d5e364bbb56b6.tar.bz2
* generic/tclIOUtil.c (TclGetOpenMode): Only set the O_APPEND flag
* tests/ioUtil.test (ioUtil-4.1): on a channel for the 'a' mode and not for 'a+'. [Bug 1773127] (backport from HEAD)
Diffstat (limited to 'tests')
-rw-r--r--tests/ioUtil.test23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/ioUtil.test b/tests/ioUtil.test
index 5b0a79e..78df642 100644
--- a/tests/ioUtil.test
+++ b/tests/ioUtil.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: ioUtil.test,v 1.13.2.1 2003/04/14 15:45:57 vincentdarley Exp $
+# RCS: @(#) $Id: ioUtil.test,v 1.13.2.2 2007/12/14 02:29:22 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -303,6 +303,27 @@ test ioUtil-3.8 {TclOpenFileChannelDeleteProc: Verify that all procs have been d
list $err9 $err10 $err11
} {{"TestOpenFileChannelProc1": could not be deleteed} {"TestOpenFileChannelProc2": could not be deleteed} {"TestOpenFileChannelProc3": could not be deleteed}}
+test ioUtil-4.1 {open ... a+ must not use O_APPEND: Bug 1773127} -setup {
+ set f [tcltest::makeFile {} ioutil41.tmp]
+ set fid [open $f w]
+ puts -nonewline $fid 123
+ close $fid
+} -body {
+ set fid [open $f a+]
+ puts -nonewline $fid 456
+ seek $fid 2
+ set d [read $fid 2]
+ seek $fid 4
+ puts -nonewline $fid x
+ close $fid
+ set fid [open $f r]
+ append d [read $fid]
+ close $fid
+ return $d
+} -cleanup {
+ tcltest::removeFile $f
+} -result 341234x6
+
cd $oldpwd
# cleanup