path-util: introduce path_simplify()
The function is similar to path_kill_slashes() but also removes
initial './', trailing '/.', and '/./' in the path.
When the second argument of path_simplify() is false, then it
behaves as the same as path_kill_slashes(). Hence, this also
replaces path_kill_slashes() with path_simplify().
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index ae39d72..6bfa44f 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -431,7 +431,7 @@
goto fail;
}
- path_kill_slashes(s);
+ path_simplify(s, false);
r = set_consume(unix_sockets, s);
if (r < 0 && r != -EEXIST) {
@@ -2289,7 +2289,7 @@
return -EBADMSG;
}
- path_kill_slashes(i.argument);
+ path_simplify(i.argument, false);
break;
case CREATE_CHAR_DEVICE:
@@ -2362,7 +2362,7 @@
return -EBADMSG;
}
- path_kill_slashes(i.path);
+ path_simplify(i.path, false);
if (!should_include_path(i.path))
return 0;