Eric Blake wrote: > Eric Blake <ebb9 <at> byu.net> writes: >> > I think we need to implement opendir_safer, alongside all the other >> > *_safer modules. Otherwise, opendir can end up placing an open directory >> > fd in one of the standard slots, and end up interfering with the intent of >> > all the other *_safer wrappers. >> >> And here's at least one use case where it matters: >> >> $ find dir -mindepth 1 -ok echo {} \; <&- >> < echo ... dir/sub > ? >> $ echo $? >> 0 > > Here's the preliminary patch series, to be applied on top of my > fchdir/fdopendir series. However, since we are also lacking openat_safer, it > looks like fts will STILL pollute the standard fds. I'll have to add in > another patch for openat-safer, then test with findutils, before calling this > series ready for prime-time. > > > From: Eric Blake <e...@byu.net> > Date: Tue, 1 Sep 2009 07:41:28 -0600 > Subject: [PATCH 1/2] dirent-safer: new module > > * modules/dirent-safer: New file. > * lib/dirent--.h: Likewise. > * lib/dirent-safer.h: Likewise. > * lib/opendir-safer.c: Likewise. > * m4/dirent-safer.m4: Likewise. > * MODULES.html.sh (Enhancements for POSIX:2008): Mention it. > * modules/dirent-safer-tests: New test. > * tests/test-dirent-safer.c: New file. > * lib/fdopendir.c (includes): Ensure fdopendir is also safe.
So far, this looks fine. I haven't built or run the code yet, but it passes the smell test ;-)