You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2001/09/05 02:55:36 UTC

Re: cvs commit: apr/file_io/unix dir.c

> rbb         01/09/04 15:54:58
> 
>   Modified:    file_io/unix dir.c
>   Log:
>   apr_dir_read (with something like APR_FINFO_TYPE in wanted) will return
>   APR_INCOMPLETE if it encounters a broken symlink... bug or feature?
>   
>   I say bug... the caller can quite happily cope with symlinks, broken or
>   not, as they wish, they just wanted to know what is in the directory.

That isn't the issue.  And this patch is correct.

When parsing the contents of an opendir, one would not expect to find symlink
targets.  One expects to discover symlinks to some targets.  It is the user's
responsibility to dig deeper.

Win32/OSX etc will (with their extended readdir mechanisms) return the fact
that an entry is a symlink, not that a symlink target happens to be a directory
(existing or no.)

Bill


>   Index: dir.c
>   ===================================================================
>   RCS file: /home/cvs/apr/file_io/unix/dir.c,v
>   retrieving revision 1.56
>   retrieving revision 1.57
>   diff -u -r1.56 -r1.57
>   --- dir.c 2001/06/15 20:04:43 1.56
>   +++ dir.c 2001/09/04 22:54:58 1.57
>   @@ -160,8 +160,7 @@
>            if (fspec[off - 1] != '/')
>                fspec[off++] = '/';
>            apr_cpystrn(fspec + off, thedir->entry->d_name, sizeof(fspec) - off);
>   -        /* ??? Or lstat below?  What is it we really want? */
>   -        ret = apr_stat(finfo, fspec, wanted, thedir->cntxt);
>   +        ret = apr_lstat(finfo, fspec, wanted, thedir->cntxt);
>        }
>    
>        if (wanted && (ret == APR_SUCCESS || ret == APR_INCOMPLETE)) {
>   
>   
>   
>