Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2004-08-28 05:37:27 +0400
committerPierre Humblet <phumblet@phumblet.no-ip.org>2004-08-28 05:37:27 +0400
commit2e41976b562f37a3a03372058798073563e09239 (patch)
tree91eaf4d8215322f19ba9742a6f7daa0908d5f6a8 /winsup
parent5796021e866211cc4661217ec37b234b334292d4 (diff)
2004-08-28 Pierre Humblet <pierre.humblet@ieee.org>
* syscalls.cc (ftruncate64): On 9x, call write with a zero length to zero fill when the file is extended.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/syscalls.cc7
2 files changed, 10 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a92166b22..c0a458131 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-28 Pierre Humblet <pierre.humblet@ieee.org>
+
+ * syscalls.cc (ftruncate64): On 9x, call write with a zero length
+ to zero fill when the file is extended.
+
2004-08-24 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (link): Avoid compiler warning.
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 1b3e3c512..d928bd6e4 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1676,7 +1676,7 @@ setmode (int fd, int mode)
extern "C" int
ftruncate64 (int fd, _off64_t length)
{
- int res = -1;
+ int res = -1, res_bug = 0;
if (length < 0)
set_errno (EINVAL);
@@ -1693,10 +1693,13 @@ ftruncate64 (int fd, _off64_t length)
_off64_t prev_loc = cfd->lseek (0, SEEK_CUR);
cfd->lseek (length, SEEK_SET);
+ /* Fill the space with 0, if needed */
+ if (wincap.has_lseek_bug ())
+ res_bug = cfd->write (&res, 0);
if (!SetEndOfFile (h))
__seterrno ();
else
- res = 0;
+ res = res_bug;
/* restore original file pointer location */
cfd->lseek (prev_loc, SEEK_SET);