Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.sources.bugs,comp.unix.wizards Subject: bug in public-domain directory routine Message-ID: <6074@brl-smoke.ARPA> Date: Mon, 6-Jul-87 18:51:21 EDT Article-I.D.: brl-smok.6074 Posted: Mon Jul 6 18:51:21 1987 Date-Received: Wed, 8-Jul-87 01:25:39 EDT Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 Keywords: getdents directory library Xref: mnetor comp.sources.bugs:80 comp.unix.wizards:3141 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