]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/delta/delta.c
fs-util: add new CHASE_TRAIL_SLASH flag for chase_symlinks()
authorLennart Poettering <lennart@poettering.net>
Thu, 22 Mar 2018 18:54:24 +0000 (19:54 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 Mar 2018 18:54:24 +0000 (19:54 +0100)
commit62570f6f03fd6defb0d053e3650457553e42085a
tree3505b0fbb64a1d78e0c4dc5cbe30806e42608220
parent1147eef0b6a5937526247ff81ca1e5e45205ed16
fs-util: add new CHASE_TRAIL_SLASH flag for chase_symlinks()

This rearranges chase_symlinks() a bit: if no special flags are
specified it will now revert to behaviour before
b12d25a8d631af00b200e7aa9dbba6ba4a4a59ff. However, if the new
CHASE_TRAIL_SLASH flag is specified it will follow the behaviour
introduced by that commit.

I wasn't sure which one to make the beaviour that requires specification
of a flag to enable. I opted to make the "append trailing slash"
behaviour the one to enable by a flag, following the thinking that the
function should primarily be used to generate a normalized path, and I
am pretty sure a path without trailing slash is the more "normalized"
one, as the trailing slash is not really a part of it, but merely a
"decorator" that tells various system calls to generate ENOTDIR if the
path doesn't refer to a path.

Or to say this differently: if the slash was part of normalization then
we really should add it in all cases when the final path is a directory,
not just when the user originally specified it.

Fixes: #8544
Replaces: #8545
src/basic/fs-util.c
src/basic/fs-util.h
src/basic/mount-util.c
src/core/dbus-manager.c
src/core/namespace.c
src/delta/delta.c
src/journal/journalctl.c
src/machine/machine-dbus.c
src/shared/dissect-image.c
src/shared/machine-image.c