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:
Art Yerkes 2006-06-04 17:24:37 +00:00
parent 36329fccb0
commit eac8defeed

View file

@ -10,9 +10,12 @@
int _chsize(int _fd, long 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)
return -1;
if (_write(_fd, 0, 0) < 0)
if (!SetEndOfFile((HANDLE)_get_osfhandle(_fd)))
return -1;
_lseek(_fd, location, SEEK_SET);
return 0;
}