RFR: 8229872: (fs) Increase buffer size used with getmntent

Alan Bateman Alan.Bateman at oracle.com
Wed Sep 4 15:38:06 UTC 2019



On 04/09/2019 15:52, Vladimir Kempik wrote:
> :
> Its no issue since newline character counted, and getmntent_r is looking for newline character. Every line in /proc/mounts ends with newline character.
> from man getline:
>         getline()  reads an entire line from stream, storing the address of the
>         buffer containing the text into *lineptr.  The  buffer  is  null-termi‐
>         nated and includes the newline character, if one was found.
It's the return value that I was wondering about as that it's the number 
of bytes written excluding the NUL.

>
>> Have you considered using fseek instead of rewind to avoid the uncertainty as to whether errno is set?
> it seems fseek vs rewind&ferror is : with fseek we will know errno while with rewind&ferror we will know the error happened but no errno.
>
> do you thinks its better to introduce fseek (but how do I specify SEEK_SET in java then, some enum?) or just rewrite native part of rewind to actually use fseek?
>
My only reason for asking is that you've got a FIXME in the comment to 
say that rewind doesn't specify how it reports errors. I checked the man 
page on macOS and it does. I also see Florian's mails to say that we 
don't need to worry about it.

-Alan



More information about the nio-dev mailing list