diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-05-31 23:39:31 +0900 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 7851cfbcac23fc8c8e167c3691a1f63fd277fa1a (patch) | |
tree | e3705f1281ae5b87b068f86390836dd2d40069ef /src/basic/cgroup-util.c | |
parent | 72307dc710d1300f40f62bab025b9a794f1e5d08 (diff) |
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().
Diffstat (limited to 'src/basic/cgroup-util.c')
-rw-r--r-- | src/basic/cgroup-util.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 0570e9abf..63117afb1 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -634,7 +634,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch if (!t) return -ENOMEM; - *fs = path_kill_slashes(t); + *fs = path_simplify(t, false); return 0; } @@ -651,7 +651,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch if (r < 0) return r; - path_kill_slashes(*fs); + path_simplify(*fs, false); return 0; } @@ -1267,7 +1267,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) { if (!t) return -ENOMEM; - *path = path_kill_slashes(t); + *path = path_simplify(t, false); } if (controller) @@ -1319,7 +1319,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) { return -EINVAL; } - path_kill_slashes(u); + path_simplify(u, false); } if (controller) @@ -1350,7 +1350,7 @@ int cg_mangle_path(const char *path, char **result) { if (!t) return -ENOMEM; - *result = path_kill_slashes(t); + *result = path_simplify(t, false); return 0; } |