chiark / gitweb /
basic/rm-rf: allow a symlink to / to be removed
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 17 Jun 2017 16:41:08 +0000 (12:41 -0400)
committerSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 07:46:52 +0000 (09:46 +0200)
commit0cd0e2ee1908a1432b06e637168f7fc8531643ec
tree2fd801585b11a1c49c06f73c2768026a7fde06fe
parent15f07f3172e69e87b1c6d3d03911e3dc38b0110c
basic/rm-rf: allow a symlink to / to be removed

We open the target path with O_DIRECTORY|O_NOFOLLOW, and if that doesn't work,
we call unlink() on the path. In neither case we will follow the symlink, so
we can relax our check to also not follow symlinks.

Fixes #5864.
src/basic/rm-rf.c