You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Joe Orton <jo...@manyfish.co.uk> on 2001/09/04 22:46:42 UTC

[PATCH] apr_dir_read use apr_lstat?

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.

Regards,

joe

Index: file_io/unix/dir.c
===================================================================
RCS file: /home/cvspublic/apr/file_io/unix/dir.c,v
retrieving revision 1.56
diff -u -r1.56 dir.c
--- file_io/unix/dir.c	2001/06/15 20:04:43	1.56
+++ file_io/unix/dir.c	2001/09/04 20:35:41
@@ -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)) {






Re: [PATCH] apr_dir_read use apr_lstat?

Posted by Ryan Bloom <rb...@covalent.net>.
On Tuesday 04 September 2001 13:46, Joe Orton wrote:

Committed.  Thanks.

Ryan

> 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.
>
> Regards,
>
> joe
>
> Index: file_io/unix/dir.c
> ===================================================================
> RCS file: /home/cvspublic/apr/file_io/unix/dir.c,v
> retrieving revision 1.56
> diff -u -r1.56 dir.c
> --- file_io/unix/dir.c	2001/06/15 20:04:43	1.56
> +++ file_io/unix/dir.c	2001/09/04 20:35:41
> @@ -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)) {

-- 

______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------