summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgls/cgls.c4
-rw-r--r--src/shared/cgroup-util.c33
2 files changed, 24 insertions, 13 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index c3229ad2d3..c689b5c471 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -156,7 +156,9 @@ int main(int argc, char *argv[]) {
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);
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index dc0fe85ee2..f57f2b2c42 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1003,19 +1003,28 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
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;