RFR: 8229872: (fs) Increase buffer size used with getmntent
Vladimir Kempik
vkempik at azul.com
Tue Sep 3 18:58:55 UTC 2019
Hello.
Looks reasonable.
Just one question
If I pass NativeBuffers.getNativeBuffer to getmntent and getmntent will decide to call realloc on that buffer.
Will such NativeBuffer then be pointing to freed memory?
If such NativeBuffer object gets destructed, will we get double free error?
Thanks, Vladimir.
Alan Bateman <Alan.Bateman at oracle.com> 3 сентября 2019 г. 20:10:45 написал:
> On 03/09/2019 17:00, Vladimir Kempik wrote:
>> Hello
>>
>>
>> Please review v4 of the patch
>>
>>
>> http://cr.openjdk.java.net/~vkempik/8229872/webrev.04/
>>
>>
>> diffs vs v3:
>> - rewind and getline moved to UnixNativeDispatcher
>> - some error handling in rewind, but according to manpage&internet,
>> ferror doesn’t set errno, so I can’t get details of error, only the
>> fact if it happened or not.
>> - bigger comment on getlinelen
> I think the approach in this version is good, just need to agree a few
> details.
>
> I think it would be better if LinuxNativeDispatcher getmntent were
> called with buf and buflen rather than maxLineLen. That is, use
> NativeBuffers.getNativeBuffer to get a uffer to pass to the native
> method. That keeps the native method simple, consistent with existing
> code, and avoids the discussion about what happens when malloc fails.
>
> In UnixNativeDispatcher then it would be nicer if rewind and getlinelen
> were after the fopen/fclose functions so that all the FILE* functions
> are together.
> The return from getlinelen needs to be a jlong rather than a long.
> Can you reformat the comments in both native functions to be consistent
> with the existing code?
>
> -Alan
More information about the nio-dev
mailing list