Bug report from luckboy: rm -f on a broken symlink didn't work because our "does...
authorRob Landley <rob@landley.net>
Sat, 13 Sep 2014 19:48:37 +0000 (14:48 -0500)
committerRob Landley <rob@landley.net>
Sat, 13 Sep 2014 19:48:37 +0000 (14:48 -0500)
commite1366f02fea3cb035cc4ed0b59d12f1962b6ebfd
treebf70ad84930fdf5d665745569374901ef087a4cf
parent8aa87ab9b4ee68eec75af26d550fbcfb732d660f
Bug report from luckboy: rm -f on a broken symlink didn't work because our "does it exist" test (to avoid errors on rm -f of nonexistent files) said it didn't.

The fix: replace the access() with unlink(), which produces the same "does not
exist" errno and has the added bonus of acting as a fastpath for rm -f on
non-directories. (And since it produces a different error on directories,
falls through to the old behavior there.)

Most of this commit is comment updates explaining being subtle. :)
toys/posix/rm.c