apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: [PATCH] apr_dir_remove_recursively
Date Wed, 23 May 2001 23:25:24 GMT
On Wed, May 23, 2001 at 05:46:07PM -0500, William A. Rowe, Jr. wrote:
> From: "Greg Stein" <gstein@lyra.org>
> Sent: Wednesday, May 23, 2001 5:21 PM
> 
>...
> > remove() on a symlink does *not* toss the target. It only removes the
> > symlink.
> 
> BUT... this is a recursive call, he walks to the end of the chain, and starts
> walking back up the tree.  That means all the files IN the symlinked directory
> would be cleared out, and the symlink removed, and the original parent directory
> [now empty] would persist.

Ah, right. As Greg Marr pointed out, I'm quite wrong in this regard. I
forgot about the recursion down into directories.

I would suggest doing the lstat() IFF a directory is found. e.g. don't
bother with it on files.

>...
> > So... don't do an lstat. That is just wasteful and unneeded.
> 
> No lstat, we should be able to get that information in the apr_dir_read call.

I'd say "no" on that. You only want to do the lstat() conditionally.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message