Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Feb 2011 11:15:39 -0600
From:      Stephen Montgomery-Smith <stephen@missouri.edu>
To:        FreeBSD Stable <freebsd-stable@freebsd.org>
Subject:   Change in behavior to stat(1)
Message-ID:  <4D6BD83B.3040609@missouri.edu>

next in thread | raw e-mail | index | archive | help
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?

Stephen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D6BD83B.3040609>