chiark / gitweb /
unit: don't allow units to be gc'ed that still are referenced via UnitRef
[elogind.git] / src / core / unit.c
index 8246837658251a100215d28bb322e6032b6dca6f..c9cd9ee2a0142b19d2e4d11e3ed6a2da28ae50a0 100644 (file)
@@ -258,6 +258,9 @@ bool unit_check_gc(Unit *u) {
         if (unit_active_state(u) != UNIT_INACTIVE)
                 return true;
 
+        if (u->refs)
+                return true;
+
         if (UNIT_VTABLE(u)->check_gc)
                 if (UNIT_VTABLE(u)->check_gc(u))
                         return true;
@@ -1004,6 +1007,9 @@ static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
         if (t != JOB_START && t != JOB_STOP && t != JOB_RELOAD)
                 return;
 
+        if (log_on_console())
+                return;
+
         /* We log status messages for all units and all operations. */
 
         format = unit_get_status_message_format_try_harder(u, t);