On Wed, Sep 12, 2001 at 10:42:53AM +0200, Tambet Ingo wrote:
> .....
> my($root);
> foreach $root (@{$roots}) {
>         $root =~ s#/\z##;
>         (undef, undef, my $rp) = lstat $root or next;
>         $rp &= 07777;   # don't forget setuid, setgid, sticky bits
>         if ( -d _ ) {
> .....
> 
> lstat succeeds, I'm calling with existing directory. But '_' will be
> left undef.

Is the file you're lstat'ing a symlink?  The point of lstat is that it gives
you the stat structure for the -symlink-, if the file is a symlink.  If the
file you're lstat'ing is a symlink to a directory the -d test is still going
to fail, because the stat structure reflects the symlink itself (and, for
obvious reasons, a symlink isn't a directory).  The stat() operator returns
the stat structure for the file the symlink points to.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to