]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/cgls/cgls.c
tree-wide: replace strjoin() with path_join()
[thirdparty/systemd.git] / src / cgls / cgls.c
index b135dd6d519e2799d8e721666f1883c4def42253..34d95c76600671a8b7e74a13693929a8ada535e8 100644 (file)
@@ -18,8 +18,8 @@
 #include "output-mode.h"
 #include "pager.h"
 #include "path-util.h"
+#include "pretty-print.h"
 #include "strv.h"
-#include "terminal-util.h"
 #include "unit-name.h"
 #include "util.h"
 
@@ -53,8 +53,8 @@ static int help(void) {
                "     --version        Show package version\n"
                "     --no-pager       Do not pipe output into a pager\n"
                "  -a --all            Show all groups, including empty\n"
-               "  -u --unit           Show the subtrees of specifified system units\n"
-               "     --user-unit      Show the subtrees of specifified user units\n"
+               "  -u --unit           Show the subtrees of specified system units\n"
+               "     --user-unit      Show the subtrees of specified user units\n"
                "  -l --full           Do not ellipsize output\n"
                "  -k                  Include kernel threads in output\n"
                "  -M --machine=       Show container\n"
@@ -146,10 +146,9 @@ static int parse_argv(int argc, char *argv[]) {
                         assert_not_reached("Unhandled option");
                 }
 
-        if (arg_machine && arg_show_unit != SHOW_UNIT_NONE) {
-                log_error("Cannot combine --unit or --user-unit with --machine=.");
-                return -EINVAL;
-        }
+        if (arg_machine && arg_show_unit != SHOW_UNIT_NONE)
+                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                       "Cannot combine --unit or --user-unit with --machine=.");
 
         return 1;
 }
@@ -166,6 +165,7 @@ static void show_cg_info(const char *controller, const char *path) {
 static int run(int argc, char *argv[]) {
         int r, output_flags;
 
+        log_show_color(true);
         log_parse_environment();
         log_open();
 
@@ -243,7 +243,7 @@ static int run(int argc, char *argv[]) {
 
                                 controller = c ?: SYSTEMD_CGROUP_CONTROLLER;
                                 if (p) {
-                                        j = strjoin(root, "/", p);
+                                        j = path_join(root, p);
                                         if (!j)
                                                 return log_oom();