Change in behavior to stat(1)

Stephen Montgomery-Smith stephen at
Mon Feb 28 17:30:11 UTC 2011

I had a little script that would remove broken links.  I used to do it 
like this:

if ! stat -L $link > /dev/null; then rm $link; fi

But recently (some time in February according to the CVS records) stat 
was changed so that stat -L would use lstat(2) if the link is broken.

So I had to change it to

if stat -L $link | awk '{print $3}' | grep l > /dev/null;
then rm $link; fi

but it is a lot less elegant.

What is the proper accepted way to remove broken links?


More information about the freebsd-stable mailing list