review request: 7114611 - SIGBUS in readdir64_r
Alan Bateman
Alan.Bateman at oracle.com
Mon Jan 30 05:13:51 PST 2012
On 25/01/2012 07:29, Dean Long wrote:
> Using name_extra[PATH_MAX + 1] would reserve more space than needed.
> The suggested fix that I contributed results in something like:
> struct {
> struct /* dirent64 */ {
> /* ... */|
> char d_name[256 /* unspecified */];
> } buf;
> | char name_extra[PATH_MAX + 1 - sizeof result->d_name];
> } entry;
> When you combine the adjacent buf.d_name[] and name_extra[], you get
> PATH_MAX + 1 char's. But that is already more than enough.
> I chose PATH_MAX + 1 because that's what the old code did,
> but according to the spec only NAME_MAX + 1 char's need to be reserved.
>
> dl
>
> http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir_r.html
>
I think Dean's suggestion seems reasonable. Ideally we should be using
NAME_MAX but that would require a fpathconf after opening the directory
to get the the max size.
-Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20120130/2af466fe/attachment.html
More information about the nio-dev
mailing list