chiark / gitweb /
log: unify log env var prefix
[elogind.git] / src / unit.c
index 3bb41a42393880dd12c3899c72a220b09131e449..c546035ca1c83e3280d091b615f6fdfd897eb521 100644 (file)
@@ -38,6 +38,7 @@
 #include "unit-name.h"
 #include "specifier.h"
 #include "dbus-unit.h"
+#include "special.h"
 
 const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
         [UNIT_SERVICE] = &service_vtable,
@@ -354,9 +355,7 @@ void unit_free(Unit *u) {
         free(u->meta.description);
         free(u->meta.fragment_path);
 
-        while ((t = set_steal_first(u->meta.names)))
-                free(t);
-        set_free(u->meta.names);
+        set_free_free(u->meta.names);
 
         free(u->meta.instance);
 
@@ -402,10 +401,7 @@ static void merge_names(Unit *u, Unit *other) {
 
         complete_move(&u->meta.names, &other->meta.names);
 
-        while ((t = set_steal_first(other->meta.names)))
-                free(t);
-
-        set_free(other->meta.names);
+        set_free_free(other->meta.names);
         other->meta.names = NULL;
         other->meta.id = NULL;
 
@@ -546,7 +542,7 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
         if ((r = unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_LOGGER_SOCKET, NULL, true)) < 0)
                 return r;
 
-        if (u->meta.manager->running_as != MANAGER_SESSION)
+        if (u->meta.manager->running_as == MANAGER_SYSTEM)
                 if ((r = unit_add_dependency_by_name(u, UNIT_REQUIRES, SPECIAL_LOGGER_SOCKET, NULL, true)) < 0)
                         return r;
 
@@ -1034,8 +1030,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
                         /* The bus just might have become available,
                          * hence try to connect to it, if we aren't
                          * yet connected. */
-                        bus_init_system(u->meta.manager);
-                        bus_init_api(u->meta.manager);
+                        bus_init(u->meta.manager);
                 }
 
                 if (unit_has_name(u, SPECIAL_SYSLOG_SERVICE))