In perl.git, the branch tonyc/truncate-win32 has been created
<http://perl5.git.perl.org/perl.git/commitdiff/881ba53aad209d17da3227741acd8a43c8b45b90?hp=0000000000000000000000000000000000000000>
at 881ba53aad209d17da3227741acd8a43c8b45b90 (commit)
- Log -----------------------------------------------------------------
commit 881ba53aad209d17da3227741acd8a43c8b45b90
Author: Tony Cook <[email protected]>
Date: Wed Jun 10 09:48:09 2015 +1000
[perl #125347] allow truncate to work on large files on Win32
truncate($filename, $size) was using a simple PerlIO_open() to open
the file, which on Win32 defaults to a text mode open.
Unfortunately, on a text mode open(), MSVCRT attempts to seek to the
end of file using only 32-bit offsets, which fails.
For good measure, add in O_LARGEFILE if it's available, which may
prevent similar issues on other platforms.
Also, remove the erroneous SETERRNO() added by 375ed12a to the open
failure branch, PerlLIO_open() should already set errno on failure, so
we get sane error messages when the open fails.
-----------------------------------------------------------------------
--
Perl5 Master Repository