mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
Merge pull request #7562 from poettering/fix-manager-test-mkdir
fix --test mode
This commit is contained in:
commit
2ac6aeace1
@ -603,6 +603,29 @@ static int manager_setup_prefix(Manager *m) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int manager_setup_run_queue(Manager *m) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(m);
|
||||||
|
assert(!m->run_queue_event_source);
|
||||||
|
|
||||||
|
r = sd_event_add_defer(m->event, &m->run_queue_event_source, manager_dispatch_run_queue, m);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = sd_event_source_set_priority(m->run_queue_event_source, SD_EVENT_PRIORITY_IDLE);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_OFF);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
(void) sd_event_source_set_description(m->run_queue_event_source, "manager-run-queue");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
|
int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
|
||||||
Manager *m;
|
Manager *m;
|
||||||
int r;
|
int r;
|
||||||
@ -687,20 +710,10 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
r = sd_event_add_defer(m->event, &m->run_queue_event_source, manager_dispatch_run_queue, m);
|
r = manager_setup_run_queue(m);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
r = sd_event_source_set_priority(m->run_queue_event_source, SD_EVENT_PRIORITY_IDLE);
|
|
||||||
if (r < 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_OFF);
|
|
||||||
if (r < 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
(void) sd_event_source_set_description(m->run_queue_event_source, "manager-run-queue");
|
|
||||||
|
|
||||||
r = manager_setup_signals(m);
|
r = manager_setup_signals(m);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -719,21 +732,23 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MANAGER_IS_SYSTEM(m)) {
|
r = manager_setup_prefix(m);
|
||||||
|
if (r < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (MANAGER_IS_SYSTEM(m) && test_run_flags == 0) {
|
||||||
r = mkdir_label("/run/systemd/units", 0755);
|
r = mkdir_label("/run/systemd/units", 0755);
|
||||||
if (r < 0 && r != -EEXIST)
|
if (r < 0 && r != -EEXIST)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m->taint_usr =
|
||||||
|
!in_initrd() &&
|
||||||
|
dir_is_empty("/usr") > 0;
|
||||||
|
|
||||||
/* Note that we do not set up the notify fd here. We do that after deserialization,
|
/* Note that we do not set up the notify fd here. We do that after deserialization,
|
||||||
* since they might have gotten serialized across the reexec. */
|
* since they might have gotten serialized across the reexec. */
|
||||||
|
|
||||||
m->taint_usr = dir_is_empty("/usr") > 0;
|
|
||||||
|
|
||||||
r = manager_setup_prefix(m);
|
|
||||||
if (r < 0)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
*_m = m;
|
*_m = m;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user