gwyn@brl-smoke.ARPA (Doug Gwyn ) (07/07/87)
R. M. Todd pointed out two problems in the getdents() emulation that I included as part of my public-domain directory library posting in early May. First, the longword buffer alignment checking that enforces a restriction mandated by the AT&T specification for getdents() is silly, especially on a system where malloc() does not longword- align storage (usually it does). It should be #ifdefed out, although I recommend leaving in the NULL pointer check. Second, on "UFS" (old-style UNIX) filesystems, DIRSIZ-long (14-character) filenames are not handled properly. (Does this sound familiar? I thought I had taken it into account but I hadn't.) One should replace the use of strlen() in the UFS case (only!) with a call to a new, file-static routine that returns either the name length (if < DIRSIZ) or DIRSIZ, whichever comes first. Rather than posting bug fixes, I'll mail you a copy of my current getdents.c, or the whole package, upon request. Gwyn@BRL.MIL