Ross Lagerwall added the comment:
That text was from the POSIX 2008 spec:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html
The following text from my copy of the readdir manpage gives an indication of
how you *should* allocate struct dirent when using readdir_r:
"""
Since POSIX.1 does not specify the size of the d_name field, and other
nonstandard fields may precede that field within the dirent structure, portable
applications that use readdir_r() should allocate the buffer whose address is
passed in entry as follows:
name_max = pathconf(dirpath, _PC_NAME_MAX);
if (name_max == -1) /* Limit not defined, or error */
name_max = 255; /* Take a guess */
len = offsetof(struct dirent, d_name) + name_max + 1;
entryp = malloc(len);
(POSIX.1 requires that d_name is the last field in a struct dirent.)
"""
I hope that helps
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com