~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to src/cgls/cgls.c

Tags: upstream-202
ImportĀ upstreamĀ versionĀ 202

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
                }
158
158
 
159
159
        } else {
160
 
                char _cleanup_free_ *p;
 
160
                _cleanup_free_ char *p;
161
161
 
162
162
                p = get_current_dir_name();
163
163
                if (!p) {
170
170
                        r = show_cgroup_by_path(p, NULL, 0,
171
171
                                                arg_kernel_threads, output_flags);
172
172
                } else {
173
 
                        char _cleanup_free_ *root = NULL;
174
 
                        const char *t = NULL;
175
 
 
176
 
                        r = cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, 1, &root);
177
 
                        if (r < 0)
178
 
                                t = "/";
179
 
                        else {
180
 
                                if (endswith(root, "/system"))
181
 
                                        root[strlen(root)-7] = 0;
182
 
 
183
 
                                t = root[0] ? root : "/";
 
173
                        _cleanup_free_ char *root = NULL;
 
174
 
 
175
                        r = cg_get_root_path(&root);
 
176
                        if (r < 0) {
 
177
                                log_error("Failed to get root path: %s", strerror(-r));
 
178
                                goto finish;
184
179
                        }
185
180
 
186
 
                        r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, t, NULL, 0,
 
181
                        r = show_cgroup(SYSTEMD_CGROUP_CONTROLLER, root, NULL, 0,
187
182
                                        arg_kernel_threads, output_flags);
188
183
                }
189
184
        }