]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/cgroup.c
string-util: add delete_trailing_chars() and skip_leading_chars() helpers
[thirdparty/systemd.git] / src / core / cgroup.c
index b717837c721e061286a1e1d4309611d7f69ed813..d81d10a2df9ac3817d8203ddd8d24d5dffb01bb5 100644 (file)
@@ -1944,11 +1944,9 @@ int manager_setup_cgroup(Manager *m) {
         if (e)
                 *e = 0;
 
-        /* And make sure to store away the root value without trailing
-         * slash, even for the root dir, so that we can easily prepend
-         * it everywhere. */
-        while ((e = endswith(m->cgroup_root, "/")))
-                *e = 0;
+        /* And make sure to store away the root value without trailing slash, even for the root dir, so that we can
+         * easily prepend it everywhere. */
+        delete_trailing_chars(m->cgroup_root, "/");
 
         /* 2. Show data */
         r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, NULL, &path);