]> git.ipfire.org Git - thirdparty/systemd.git/commit
fs-util: introduce open_parent() helper
authorLennart Poettering <lennart@poettering.net>
Fri, 20 Jul 2018 09:57:24 +0000 (11:57 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 23 Jul 2018 11:38:18 +0000 (13:38 +0200)
commitef8becfac5f1d8e0cfce69afd3aadffb330efb70
tree5fee61257e1024a0164e8b43e0810a74a56efdb2
parent09942654d30c71718c5230d4423ad0b1ab6ebadb
fs-util: introduce open_parent() helper

We often open the parent directory of a path. Let's add a common helper
for that, that shortens our code a bit and adds some extra safety
checks, for example it will fail if used on the root directory (which
doesn't really have a parent).

The helper is actually generalized from a function in btrfs-util.[ch]
which already existed for this purpose.
src/basic/btrfs-util.c
src/basic/fs-util.c
src/basic/fs-util.h