Re: [PATCH 14/17] Add ftruncate implementation for MSVC
- From
Marius Storm-Olsen <marius@storm-olsen.com>
- Date
- Sep 14, 2009, 19:03 UTC
- Message-ID
- <4AAE9369.8030007@gmail.com>
- In-Reply-To
- <81b0412b0909140718i7d2c4e3cpc96477f8374d80b4@mail.gmail.com>
Alex Riesen said the following on 14.09.2009 16:18:
Show 7 quoted lines
> On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:
>> +int ftruncate(int fd, __int64 length)
>> +{
>> + HANDLE fh = (HANDLE)_get_osfhandle(fd);
>> + if (!fh || _lseeki64(fd, length, SEEK_SET))
>
> According to MSDN, error is manifested by returning INVALID_HANDLE_VALUE (–1):You're absolutely right. I was too deep in Posix-land when writing this. Updated patch will follow tomorrow.
-- .marius