chiark / gitweb /
journal: call connect() with dropped privileges
[elogind.git] / src / core / manager.c
index cff24fa68e354366b08d5a605a521842128aed45..519b37438244c0a2bafe363d67c6f4054baf89b7 100644 (file)
@@ -69,7 +69,7 @@
 #include "audit-fd.h"
 #include "boot-timestamps.h"
 #include "env-util.h"
-#include "bus-errors.h"
+#include "bus-common-errors.h"
 #include "bus-error.h"
 #include "bus-util.h"
 #include "dbus.h"
@@ -162,6 +162,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
         uint64_t x;
 
         assert(m);
+        assert(m->n_running_jobs > 0);
 
         manager_flip_auto_status(m, true);
 
@@ -184,8 +185,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
         m->jobs_in_progress_iteration++;
 
         if (m->n_running_jobs > 1)
-                if (asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs) < 0)
-                        job_of_n = NULL;
+                asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs);
 
         format_timespan(time, sizeof(time), now(CLOCK_MONOTONIC) - j->begin_usec, 1*USEC_PER_SEC);
         if (job_get_timeout(j, &x) > 0)
@@ -197,7 +197,6 @@ static void manager_print_jobs_in_progress(Manager *m) {
                               job_type_to_string(j->type),
                               unit_description(j->unit),
                               time, limit);
-
 }
 
 static int have_ask_password(void) {
@@ -440,7 +439,7 @@ static int manager_setup_signals(Manager *m) {
                         SIGRTMIN+26, /* systemd: set log target to journal-or-kmsg */
                         SIGRTMIN+27, /* systemd: set log target to console */
                         SIGRTMIN+28, /* systemd: set log target to kmsg */
-                        SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg (obsolete)*/
+                        SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg (obsolete) */
 
                         /* ... one free signal here SIGRTMIN+30 ... */
 #endif
@@ -946,20 +945,29 @@ Manager* manager_free(Manager *m) {
 }
 
 int manager_enumerate(Manager *m) {
-        int r = 0, q;
+        int r = 0;
         UnitType c;
 
         assert(m);
 
         /* Let's ask every type to load all units from disk/kernel
          * that it might know */
-        for (c = 0; c < _UNIT_TYPE_MAX; c++)
-                if (unit_vtable[c]->enumerate) {
-                        q = unit_vtable[c]->enumerate(m);
-                        if (q < 0)
-                                r = q;
+        for (c = 0; c < _UNIT_TYPE_MAX; c++) {
+                int q;
+
+                if (unit_vtable[c]->supported && !unit_vtable[c]->supported(m)) {
+                        log_info("Unit type .%s is not supported on this system.", unit_type_to_string(c));
+                        continue;
                 }
 
+                if (!unit_vtable[c]->enumerate)
+                        continue;
+
+                q = unit_vtable[c]->enumerate(m);
+                if (q < 0)
+                        r = q;
+        }
+
         manager_dispatch_load_queue(m);
         return r;
 }
@@ -1019,7 +1027,7 @@ static void manager_build_unit_path_cache(Manager *m) {
                 while ((de = readdir(d))) {
                         char *p;
 
-                        if (ignore_file(de->d_name))
+                        if (hidden_file(de->d_name))
                                 continue;
 
                         p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
@@ -2626,9 +2634,6 @@ void manager_check_finished(Manager *m) {
 
         assert(m);
 
-        if (m->n_running_jobs == 0)
-                m->jobs_in_progress_event_source = sd_event_source_unref(m->jobs_in_progress_event_source);
-
         if (hashmap_size(m->jobs) > 0) {
 
                 if (m->jobs_in_progress_event_source)