X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmanager.c;h=7fd860ed06666db407eb06c42920d3eb5c287e2f;hp=ac5bbef1a802ef63f2b190c2781e73707baad11d;hb=81527be142678057215665be66e4b3c8306a7ab3;hpb=87d2c1ff6a7375f03476767e6f59454bcc5cd04b diff --git a/src/manager.c b/src/manager.c index ac5bbef1a..7fd860ed0 100644 --- a/src/manager.c +++ b/src/manager.c @@ -41,6 +41,8 @@ #include #endif +#include + #include "manager.h" #include "hashmap.h" #include "macro.h" @@ -58,7 +60,6 @@ #include "special.h" #include "bus-errors.h" #include "exit-status.h" -#include "sd-daemon.h" #include "virt.h" /* As soon as 16 units are in our GC queue, make sure to run a gc sweep */ @@ -231,7 +232,7 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) { dual_timestamp_get(&m->startup_timestamp); m->running_as = running_as; - m->name_data_slot = m->subscribed_data_slot = -1; + m->name_data_slot = m->conn_data_slot = m->subscribed_data_slot = -1; m->exit_code = _MANAGER_EXIT_CODE_INVALID; m->pin_cgroupfs_fd = -1; @@ -286,7 +287,10 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) { goto fail; #ifdef HAVE_AUDIT - if ((m->audit_fd = audit_open()) < 0) + if ((m->audit_fd = audit_open()) < 0 && + /* If the kernel lacks netlink or audit support, + * don't worry about it. */ + errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT) log_error("Failed to connect to audit log: %m"); #endif @@ -1214,13 +1218,18 @@ static int transaction_apply(Manager *m, JobMode mode) { /* When isolating first kill all installed jobs which * aren't part of the new transaction */ + rescan: HASHMAP_FOREACH(j, m->jobs, i) { assert(j->installed); if (hashmap_get(m->transaction_jobs, j->unit)) continue; - job_finish_and_invalidate(j, JOB_CANCELED); + /* 'j' itself is safe to remove, but if other jobs + are invalidated recursively, our iterator may become + invalid and we need to start over. */ + if (job_finish_and_invalidate(j, JOB_CANCELED) > 0) + goto rescan; } }