summaryrefslogtreecommitdiff
path: root/src/basic/unit-name.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/unit-name.c')
-rw-r--r--src/basic/unit-name.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
index ba9928375e..27ce432197 100644
--- a/src/basic/unit-name.c
+++ b/src/basic/unit-name.c
@@ -382,19 +382,14 @@ int unit_name_path_escape(const char *f, char **ret) {
if (STR_IN_SET(p, "/", ""))
s = strdup("-");
else {
- char *e;
-
if (!path_is_safe(p))
return -EINVAL;
/* Truncate trailing slashes */
- e = endswith(p, "/");
- if (e)
- *e = 0;
+ delete_trailing_chars(p, "/");
/* Truncate leading slashes */
- if (p[0] == '/')
- p++;
+ p = skip_leading_chars(p, "/");
s = unit_name_escape(p);
}