diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-22 19:54:24 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-03-22 19:54:24 +0100 |
commit | 62570f6f03fd6defb0d053e3650457553e42085a (patch) | |
tree | 3505b0fbb64a1d78e0c4dc5cbe30806e42608220 /src/delta | |
parent | 1147eef0b6a5937526247ff81ca1e5e45205ed16 (diff) | |
download | systemd-62570f6f03fd6defb0d053e3650457553e42085a.tar.gz |
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
Diffstat (limited to 'src/delta')
-rw-r--r-- | src/delta/delta.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/delta/delta.c b/src/delta/delta.c index 49d9f0bb03..dc064b4c07 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -90,11 +90,11 @@ static int equivalent(const char *a, const char *b) { _cleanup_free_ char *x = NULL, *y = NULL; int r; - r = chase_symlinks(a, NULL, 0, &x); + r = chase_symlinks(a, NULL, CHASE_TRAIL_SLASH, &x); if (r < 0) return r; - r = chase_symlinks(b, NULL, 0, &y); + r = chase_symlinks(b, NULL, CHASE_TRAIL_SLASH, &y); if (r < 0) return r; |