mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:42:59 +00:00
Fix four winetests from msvcrt:file.c
- The winetests show that the pointer never moves after calling chsize. - Using SetEndOfFile is the best way to do this. I wrote a test case that uses WriteFile as we did before and it did not expand the file past eof. svn path=/trunk/; revision=22216
This commit is contained in:
parent
36329fccb0
commit
eac8defeed
1 changed files with 4 additions and 1 deletions
|
@ -10,9 +10,12 @@
|
||||||
int _chsize(int _fd, long size)
|
int _chsize(int _fd, long size)
|
||||||
{
|
{
|
||||||
DPRINT("_chsize(fd %d, size %d)\n", _fd, size);
|
DPRINT("_chsize(fd %d, size %d)\n", _fd, size);
|
||||||
|
long location = _lseek(_fd, 0, SEEK_CUR);
|
||||||
|
if (location == -1) return -1;
|
||||||
if (_lseek(_fd, size, 0) == -1)
|
if (_lseek(_fd, size, 0) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
if (_write(_fd, 0, 0) < 0)
|
if (!SetEndOfFile((HANDLE)_get_osfhandle(_fd)))
|
||||||
return -1;
|
return -1;
|
||||||
|
_lseek(_fd, location, SEEK_SET);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue