chiark / gitweb /
cgroup: when referencing cgroup controller trees allow omission of the path
authorLennart Poettering <lennart@poettering.net>
Thu, 26 Sep 2013 17:57:58 +0000 (19:57 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 26 Sep 2013 18:20:30 +0000 (20:20 +0200)
TODO
src/cgls/cgls.c
src/shared/cgroup-util.c

diff --git a/TODO b/TODO
index 0f2398a7ab9f072fa22c4ad2cdb828af8aad696f..474532164b001ded6fc8371902655038e6f975e9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -56,6 +56,8 @@ CGroup Rework Completion:
 
 Features:
 
 
 Features:
 
+* move config_parse_path_strv() out of conf-parser.c
+
 * libdsystemd-bus should expose utf8 validation calls
 
 * When using "systemd status" on a slice unit also show all messages
 * libdsystemd-bus should expose utf8 validation calls
 
 * When using "systemd status" on a slice unit also show all messages
index c3229ad2d3dbca66dc7c21c3d088423dd9d78bc5..c689b5c471c47d1be64f48d080e0c53f4eaccd8a 100644 (file)
@@ -156,7 +156,9 @@ int main(int argc, char *argv[]) {
 
                 for (i = optind; i < argc; i++) {
                         int q;
 
                 for (i = optind; i < argc; i++) {
                         int q;
-                        printf("%s:\n", argv[i]);
+
+                        fprintf(stdout, "%s:\n", argv[i]);
+                        fflush(stdout);
 
                         if (arg_machine)
                                 root = strjoin("machine/", arg_machine, "/", argv[i], NULL);
 
                         if (arg_machine)
                                 root = strjoin("machine/", arg_machine, "/", argv[i], NULL);
index dc0fe85ee22a3fb189253b1c2f044348bf453e2a..f57f2b2c42b8c5db2dea7d783597068c2ffe0673 100644 (file)
@@ -1003,19 +1003,28 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
                 return -EINVAL;
         }
 
                 return -EINVAL;
         }
 
-        u = strdup(e+1);
-        if (!u) {
-                free(t);
-                return -ENOMEM;
-        }
-        if (!path_is_safe(u) ||
-            !path_is_absolute(u)) {
-                free(t);
-                free(u);
-                return -EINVAL;
-        }
+        if (streq(e+1, "")) {
+                u = strdup("/");
+                if (!u) {
+                        free(t);
+                        return -ENOMEM;
+                }
+        } else {
+                u = strdup(e+1);
+                if (!u) {
+                        free(t);
+                        return -ENOMEM;
+                }
 
 
-        path_kill_slashes(u);
+                if (!path_is_safe(u) ||
+                    !path_is_absolute(u)) {
+                        free(t);
+                        free(u);
+                        return -EINVAL;
+                }
+
+                path_kill_slashes(u);
+        }
 
         if (controller)
                 *controller = t;
 
         if (controller)
                 *controller = t;