Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix-wizards,net.bugs.usg Subject: Re: ls(1) on System V Message-ID: <2116@sun.uucp> Date: Thu, 11-Apr-85 02:15:10 EST Article-I.D.: sun.2116 Posted: Thu Apr 11 02:15:10 1985 Date-Received: Sat, 13-Apr-85 04:03:21 EST References: <176@mplvax.UUCP> <3411@allegra.UUCP> Organization: Sun Microsystems, Inc. Lines: 19 Xref: watmath net.unix-wizards:12787 net.bugs.usg:211 > Well, the problem is that in the readdir() routine, the code is doing > strlen(dentry.d_name), and d_name isn't null-terminated if it's 14 > characters long (I think strlen returns 44 or so). This is the second S5R2 bug that is fixed "for free" if you convert to the Berkeley "directory library". The library provides directory entries with null-terminated names, fixing this bug; the previous bug was a shell problem caused, if I remember correctly, by testing whether the result of an "open" of a directory was > 0 rather than whether it was >= 0. I've converted lots of S5R2 programs to use the library; it's very easy. I'd vote for putting it into 1) the /usr/group standard, 2) the System V Interface Definition (which currently, bless its soul, does *not* commit to what directories look like when you open them), and therefore 3) System V. Guy Harris sun!guy