btrfs-util: when opening subvolume fds, always set O_NOFOLLOW
authorLennart Poettering <lennart@poettering.net>
Wed, 4 Oct 2017 11:48:51 +0000 (13:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 26 Oct 2017 15:54:56 +0000 (17:54 +0200)
commitf7c9f4a2a9bdb476b6b0e0e88291fa8d5e9fc0de
tree10f4323777edbb04fc989ca70e03c9f385c878d8
parent530c1c3028c484c503725bbac769b9051af83da7
btrfs-util: when opening subvolume fds, always set O_NOFOLLOW

Some of the btrfs utility functions already used O_NOFOLLOW others
didn't. Let's streamline this, and refuse operation when we are called
for symlinks on "remove" and "snapshot" too.

In particular in the "remove" case following symlinks is a bad idea, and
is quite different from how unlink() and friends work, which always
remove the symlink, and not the destination, a logic we should follow
here too.
src/basic/btrfs-util.c