[EMAIL PROTECTED] wrote:
> >Do you mean:
> >
> > sprintf(buf, "/proc/self/fd/%d/%s", dfd, dname);
> > dp = opendir(buf);
>
> Yes.
>
> >> Not sure why you have all the dup's in there.
> >
> >Because closedir() will also close the fd passed to fdopendir()
> >and I need the fd for a reliable chdir("..") later.
>
> You can do the chdir before the closedir.
Depends... I am not sure whether this will result in clean code
for libfind.
> The current rm source keeps a stack of open directories but, since it
> must allow for unlimited depth trees it verifies it can go back up before
> closing the parent directory. And it uses only one filedescriptor per
> level (including the one used for opendir)
You may have a look at libfind (e.g. from a recent cdrtools
ftp://ftp.berlios.de/pub/cdrecord/alpha/) to see how to do this without the
need to use filedescriptors. A library cannot eat as many fd's as it may like...
I will still have libfind to use an openat() based implementation
in order to support infinite path length in a thread safe way in case the OS
supports openat(). The basic algorithm will stay the same as today.
Jörg
--
EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
[EMAIL PROTECTED] (uni)
[EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-discuss mailing list
[email protected]