#9466: Bug in readdir_r? ----------------------------+------------------------- Reporter: fabbo | Owner: nobody Type: bug | Status: reopened Priority: normal | Milestone: R1 Component: System/POSIX | Version: R1/alpha4.1 Resolution: | Keywords: Blocked By: | Blocking: Has a Patch: 0 | Platform: All ----------------------------+------------------------- Comment (by bonefish): At least the [http://man7.org/linux/man-pages/man3/readdir.3.html Linux man page] is pretty explicit about how to use `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); }}} That aside, it is not entirely trivial to change the size of the `d_name` field. There's quite a bit of code that would need to be reviewed (file systems, VFS, storage kit) and the (binary/source) compatibility implications need to be weighed as well. -- Ticket URL: <https://dev.haiku-os.org/ticket/9466#comment:5> Haiku <https://dev.haiku-os.org> Haiku - the operating system.