From 62570f6f03fd6defb0d053e3650457553e42085a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 22 Mar 2018 19:54:24 +0100 Subject: 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/delta/delta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/delta') 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; -- cgit v1.2.1