[systemd-commits] 4 commits - src/dbus.c src/dbus-manager.c src/job.c src/manager.h src/service.c src/systemctl.c src/unit.c

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jul 6 17:21:51 PDT 2010


 src/dbus-manager.c |    1 +
 src/dbus.c         |   14 ++++++++++++--
 src/job.c          |    2 +-
 src/manager.h      |    1 +
 src/service.c      |   15 ++++++++-------
 src/systemctl.c    |    7 +++----
 src/unit.c         |    4 +---
 7 files changed, 27 insertions(+), 17 deletions(-)

New commits:
commit 7b97f4773207d9e1301f5263229ceba26b515756
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 7 02:21:16 2010 +0200

    dbus: send reload completion message on right connection

diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index cd6a975..7bf58b3 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -641,6 +641,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 if (!(m->queued_message = dbus_message_new_method_return(message)))
                         goto oom;
 
+                m->queued_message_connection = connection;
                 m->exit_code = MANAGER_RELOAD;
 
         } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Reexecute")) {
diff --git a/src/dbus.c b/src/dbus.c
index 6660cf0..576f785 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -496,12 +496,13 @@ unsigned bus_dispatch(Manager *m) {
                  * dispatch any D-Bus messages, so that we won't end
                  * up wanting to queue another message. */
 
-                if (m->api_bus)
-                        if (!dbus_connection_send(m->api_bus, m->queued_message, NULL))
+                if (m->queued_message_connection)
+                        if (!dbus_connection_send(m->queued_message_connection, m->queued_message, NULL))
                                 return 0;
 
                 dbus_message_unref(m->queued_message);
                 m->queued_message = NULL;
+                m->queued_message_connection = NULL;
         }
 
         if ((c = set_first(m->bus_connections_for_dispatch))) {
@@ -991,6 +992,15 @@ static void shutdown_connection(Manager *m, DBusConnection *c) {
                 set_free(s);
         }
 
+        if (m->queued_message_connection == c) {
+                m->queued_message_connection = NULL;
+
+                if (m->queued_message) {
+                        dbus_message_unref(m->queued_message);
+                        m->queued_message = NULL;
+                }
+        }
+
         dbus_connection_set_dispatch_status_function(c, NULL, NULL, NULL);
         dbus_connection_flush(c);
         dbus_connection_close(c);
diff --git a/src/manager.h b/src/manager.h
index b997181..5b3aaf3 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -160,6 +160,7 @@ struct Manager {
                                       * before the reload we queue the
                                       * reply message here, and
                                       * afterwards we send it */
+        DBusConnection *queued_message_connection; /* The connection to send the queued message on */
 
         Hashmap *watch_bus;  /* D-Bus names => Unit object n:1 */
         int32_t name_data_slot;
commit ed4c1cc672560b72aa1c5a74cd692a65811dd589
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 7 02:16:14 2010 +0200

    unit: when reading description from LSB prefer short over long description

diff --git a/src/service.c b/src/service.c
index d689734..c9abb08 100644
--- a/src/service.c
+++ b/src/service.c
@@ -457,7 +457,8 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                         s->sysv_runlevels = d;
                                 }
 
-                        } else if (startswith_no_case(t, "description:")) {
+                        } else if (startswith_no_case(t, "description:") &&
+                                   !u->meta.description) {
 
                                 size_t k = strlen(t);
                                 char *d;
@@ -603,9 +604,13 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                         s->sysv_runlevels = d;
                                 }
 
-                        } else if (startswith_no_case(t, "Description:")) {
+                        } else if (startswith_no_case(t, "Description:") &&
+                                   !u->meta.description) {
                                 char *d;
 
+                                /* We use the long description only if
+                                 * no short description is set. */
+
                                 state = LSB_DESCRIPTION;
 
                                 if (!(d = strdup(strstrip(t+12)))) {
@@ -616,13 +621,9 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                 free(u->meta.description);
                                 u->meta.description = d;
 
-                        } else if (startswith_no_case(t, "Short-Description:") &&
-                                   !u->meta.description) {
+                        } else if (startswith_no_case(t, "Short-Description:")) {
                                 char *d;
 
-                                /* We use the short description only
-                                 * if no long description is set. */
-
                                 state = LSB;
 
                                 if (!(d = strdup(strstrip(t+18)))) {
commit 9aab5a731db87f96101c2eb5d2b15ac45c3a33c3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 7 02:15:38 2010 +0200

    unit: don't cancel dependent jobs if a stopped daemon returned an error code

diff --git a/src/job.c b/src/job.c
index 2199d75..0a9ce15 100644
--- a/src/job.c
+++ b/src/job.c
@@ -484,7 +484,7 @@ int job_finish_and_invalidate(Job *j, bool success) {
         job_free(j);
 
         if (!success)
-                unit_status_printf(u, "Starting %s... " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u));
+                unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u));
 
         /* Fail depending jobs on failure */
         if (!success) {
diff --git a/src/unit.c b/src/unit.c
index 701dbc0..4810d2b 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1020,10 +1020,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
                 case JOB_RESTART:
                 case JOB_TRY_RESTART:
 
-                        if (ns == UNIT_INACTIVE)
+                        if (ns == UNIT_INACTIVE || ns == UNIT_MAINTENANCE)
                                 job_finish_and_invalidate(u->meta.job, true);
-                        else if (ns == UNIT_MAINTENANCE)
-                                job_finish_and_invalidate(u->meta.job, false);
                         else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) {
                                 unexpected = true;
                                 job_finish_and_invalidate(u->meta.job, false);
commit 7e61bf2019c2cab4e1e21ee775bab25ef1a1bb81
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 7 02:11:14 2010 +0200

    systemctl: minor cosmetic fixes

diff --git a/src/systemctl.c b/src/systemctl.c
index 02c8e30..5c91c32 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -242,7 +242,7 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) {
                         if (job_id != 0)
                                 printf(" %-15s%n", job_type, &b);
                         else
-                                b = 1 + 15;
+                                b = 1 + 16;
 
                         if (a + b + 2 < columns()) {
                                 if (job_id == 0)
@@ -952,8 +952,6 @@ static void show_cgroup(const char *name) {
         if (!f)
                 return;
 
-        printf("\t\t  \342\224\202\n");
-
         while (!feof(f)) {
                 unsigned long ul;
 
@@ -968,7 +966,8 @@ static void show_cgroup(const char *name) {
                         get_process_cmdline(last, 60, &t);
                         printf("\t\t  \342\224\234 %lu %s\n", (unsigned long) last, strna(t));
                         free(t);
-                }
+                } else
+                        printf("\t\t  \342\224\202\n");
 
                 last = (pid_t) ul;
         }


More information about the systemd-commits mailing list