This script fails on Linux 2.2.19, AS 3.4, gnu libc 2.1.2:

set fd [open xyz w]
puts $fd "abcdefg"
close $fd

set fd [open xyz r+]
seek $fd 4
puts -nonewline $fd "x"
ns_ftruncate $fd 3
close $fd
return

After this executes, the file should contain 3 bytes because of the
ns_ftruncate call.

Instead, the file contains:

abc^@x

where ^@ is a zero byte.

Using ns_truncate after closing the file works correctly.

(NOTE: the xyz file is created in your server's home directory)

Jim

Reply via email to