NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/37730: libc-level getdirentries compat behavior loses



On Wed, Jan 09, 2008 at 06:45:01PM +0000, dholland%eecs.harvard.edu@localhost 
wrote:
 > If you compile new code that uses getdirentries() instead of
 > getdents(), it gets dirent12 structs returned but necessarily ends up
 > using the current struct dirent to examine them. Needless to say, this
 > doesn't work.
 > 
 > [...]
 >
 > >Fix:
 > Mumble.

I discussed this with Christos some time ago. The conclusion was that
(1) getdirentries() can and should be tagged with __warn_references,
and (2) nothing more aggressive is workable.

So here, finally, is the patch:

Index: compat_getdirentries.c
===================================================================
RCS file: /cvsroot/src/lib/libc/compat/sys/compat_getdirentries.c,v
retrieving revision 1.1
diff -u -r1.1 compat_getdirentries.c
--- compat_getdirentries.c      13 Sep 2005 01:44:09 -0000      1.1
+++ compat_getdirentries.c      24 Aug 2008 23:48:40 -0000
@@ -44,6 +44,9 @@
 #include <compat/include/dirent.h>
 #include <unistd.h>
 
+__warn_references(getdirentries,
+    "reference to compatibility-only getdirentries(); this will break; use 
getdents() or readdir() instead")
+
 int
 getdirentries(fd, buf, nbytes, basep)
        int fd, nbytes;


-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index