[EMAIL PROTECTED] wrote:

>
> >Linux started to support openat() recently and for this reason,
> >the best way of implementing a portable way of directory search without
> >path length limitation is to use:
> >
> >ndfd = openat(dfd, "dname", O_RDONLY);
> >close(dfd);
> >dfd = ndfd;
> >dp = fdopendir(dup(dfd));
>
> Interesting is, of course, that /proc/self/fd has made this obsolete
> in an interesting sense.
>
> (openat maps to:
>       sprintf(buf, "/proc/self/%d/%s", dfd, dname);

Do you mean:

        sprintf(buf, "/proc/self/fd/%d/%s", dfd, dname);
        dp = opendir(buf);

> 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.

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]

Reply via email to