[PATCH 2/2] posix_fallocate() *returns* error codes but does not set errno

Erik Bray erik.m.bray@gmail.com
Thu Nov 2 15:21:00 GMT 2017


On Thu, Nov 2, 2017 at 4:06 PM, Corinna Vinschen wrote:
> Hi Erik,
>
> On Nov  2 15:15, Erik M. Bray wrote:
>> diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
>> index f46e355..9d5ec30 100644
>> --- a/winsup/cygwin/fhandler_disk_file.cc
>> +++ b/winsup/cygwin/fhandler_disk_file.cc
>> @@ -1116,11 +1116,11 @@ fhandler_disk_file::ftruncate (off_t length, bool allow_truncate)
>>    int res = -1;
>
> Shouldn't this initialization to -1 go away then?  Or set to 0 and...
>
>> @@ -1160,7 +1159,7 @@ fhandler_disk_file::ftruncate (off_t length, bool allow_truncate)
>>                                    &feofi, sizeof feofi,
>>                                    FileEndOfFileInformation);
>>        if (!NT_SUCCESS (status))
>> -     __seterrno_from_nt_status (status);
>> +     res = geterrno_from_nt_status (status);
>>        else
>>       res = 0;
>
> ...this else branch go away like you did in posix_fallocate?

Yes, I think you're right.  I'll rework this and the other patch per
your suggestions and re-post.

Thanks for the quick review,
Erik



More information about the Cygwin-patches mailing list