[systemd-commits] fixme src/systemctl.c

Lennart Poettering lennart at kemper.freedesktop.org
Thu Aug 12 16:29:51 PDT 2010


 fixme           |    4 +++-
 src/systemctl.c |   23 +++++++++++++----------
 2 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit c31b4423a94bc66689bafec0ce423127e63abca4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 13 01:28:05 2010 +0200

    systemctl: show sysv path if it is set if the fragment path isn't in systemctl status

diff --git a/fixme b/fixme
index 77cbb43..e255dee 100644
--- a/fixme
+++ b/fixme
@@ -75,7 +75,9 @@
 
 * plymouth after/before getty?
 
-* in systemctl show sysv init script path
+* D-Bus call GetUnitByPID
+
+* be more forgiving when parsing unit files, when encountering incorrect lines with non assignments
 
 External:
 
diff --git a/src/systemctl.c b/src/systemctl.c
index e1d4f93..8f7755f 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1418,7 +1418,7 @@ typedef struct UnitStatusInfo {
 
         const char *description;
 
-        const char *fragment_path;
+        const char *path;
         const char *default_control_group;
 
         bool need_daemon_reload;
@@ -1467,15 +1467,16 @@ static void print_status_info(UnitStatusInfo *i) {
 
         printf("\n");
 
-        if (i->fragment_path)
-                printf("\t  Loaded: %s (%s)\n", strna(i->load_state), i->fragment_path);
-        else if (streq_ptr(i->load_state, "failed"))
-                printf("\t  Loaded: %s%s%s\n",
-                       ansi_highlight(true),
-                       strna(i->load_state),
-                       ansi_highlight(false));
+        if (streq_ptr(i->load_state, "failed")) {
+                on = ansi_highlight(true);
+                off = ansi_highlight(false);
+        } else
+                on = off = "";
+
+        if (i->path)
+                printf("\t  Loaded: %s%s%s (%s)\n", on, strna(i->load_state), off, i->path);
         else
-                printf("\t  Loaded: %s\n", strna(i->load_state));
+                printf("\t  Loaded: %s%s%s\n", on, strna(i->load_state), off);
 
         ss = streq_ptr(i->active_state, i->sub_state) ? NULL : i->sub_state;
 
@@ -1623,7 +1624,9 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
                         else if (streq(name, "Description"))
                                 i->description = s;
                         else if (streq(name, "FragmentPath"))
-                                i->fragment_path = s;
+                                i->path = s;
+                        else if (streq(name, "SysVPath"))
+                                i->path = s;
                         else if (streq(name, "DefaultControlGroup"))
                                 i->default_control_group = s;
                         else if (streq(name, "StatusText"))


More information about the systemd-commits mailing list