From 979b2abbdde5ba5e985eca343e67ebadd2a7c220 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 17 Aug 2023 13:11:11 +0200 Subject: [PATCH] parse-helpers: Add PATH_KEEP_TRAILING_SLASH (cherry picked from commit ce60b3a40a89bb5d116003343c56c55a0da9f8fb) --- src/shared/parse-helpers.c | 2 +- src/shared/parse-helpers.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shared/parse-helpers.c b/src/shared/parse-helpers.c index f48baf7146..9664b9c773 100644 --- a/src/shared/parse-helpers.c +++ b/src/shared/parse-helpers.c @@ -40,7 +40,7 @@ int path_simplify_and_warn( lvalue, fatal ? "" : ", ignoring", path); } - path_simplify(path); + path_simplify_full(path, flag & PATH_KEEP_TRAILING_SLASH ? PATH_SIMPLIFY_KEEP_TRAILING_SLASH : 0); if (!path_is_valid(path)) return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL), diff --git a/src/shared/parse-helpers.h b/src/shared/parse-helpers.h index 38a47e85c3..3e4ad3c0a1 100644 --- a/src/shared/parse-helpers.h +++ b/src/shared/parse-helpers.h @@ -4,9 +4,10 @@ #include enum { - PATH_CHECK_FATAL = 1 << 0, /* If not set, then error message is appended with 'ignoring'. */ - PATH_CHECK_ABSOLUTE = 1 << 1, - PATH_CHECK_RELATIVE = 1 << 2, + PATH_CHECK_FATAL = 1 << 0, /* If not set, then error message is appended with 'ignoring'. */ + PATH_CHECK_ABSOLUTE = 1 << 1, + PATH_CHECK_RELATIVE = 1 << 2, + PATH_KEEP_TRAILING_SLASH = 1 << 3, }; int path_simplify_and_warn(