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



The following reply was made to PR lib/37730; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
        netbsd-bugs%netbsd.org@localhost
Subject: Re: lib/37730: libc-level getdirentries compat behavior loses
Date: Sun, 24 Aug 2008 23:54:30 +0000

 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