]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
parse-helpers: Add PATH_KEEP_TRAILING_SLASH
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 17 Aug 2023 11:11:11 +0000 (13:11 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 17 Aug 2023 11:23:39 +0000 (13:23 +0200)
src/shared/parse-helpers.c
src/shared/parse-helpers.h

index f48baf7146e71f91a9de0b723fc46e37feb22435..9664b9c773bcbc23156fcffe3718fd5ced4aaa24 100644 (file)
@@ -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),
index 38a47e85c339e8f03f4ad8dc2722a25bf4950afc..3e4ad3c0a1d58bcd6a6de452a95f5d912c8e4eaf 100644 (file)
@@ -4,9 +4,10 @@
 #include <stdint.h>
 
 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(