diff options
Diffstat (limited to 'src/manager.c')
-rw-r--r-- | src/manager.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/manager.c b/src/manager.c index 258b3ca4b7..3291275d0a 100644 --- a/src/manager.c +++ b/src/manager.c @@ -136,7 +136,7 @@ static int enable_special_signals(Manager *m) { if (reboot(RB_DISABLE_CAD) < 0) log_warning("Failed to enable ctrl-alt-del handling: %m"); - if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY)) < 0) + if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) log_warning("Failed to open /dev/tty0: %m"); else { /* Enable that we get SIGWINCH on kbrequest */ @@ -595,7 +595,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { * this is already known, so we increase the counter here * already */ if (serialization) - m->n_deserializing ++; + m->n_reloading ++; /* First, enumerate what we can from all config files */ r = manager_enumerate(m); @@ -610,8 +610,8 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { r = q; if (serialization) { - assert(m->n_deserializing > 0); - m->n_deserializing --; + assert(m->n_reloading > 0); + m->n_reloading --; } return r; @@ -2476,7 +2476,7 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) { /* Don't generate audit events if the service was already * started and we're just deserializing */ - if (m->n_deserializing > 0) + if (m->n_reloading > 0) return; if (m->running_as != MANAGER_SYSTEM) @@ -2517,7 +2517,7 @@ void manager_send_unit_plymouth(Manager *m, Unit *u) { /* Don't generate plymouth events if the service was already * started and we're just deserializing */ - if (m->n_deserializing > 0) + if (m->n_reloading > 0) return; if (m->running_as != MANAGER_SYSTEM) @@ -2659,7 +2659,7 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) { assert(f); assert(fds); - m->n_serializing ++; + m->n_reloading ++; fprintf(f, "current-job-id=%i\n", m->current_job_id); fprintf(f, "taint-usr=%s\n", yes_no(m->taint_usr)); @@ -2682,13 +2682,13 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) { fputc('\n', f); if ((r = unit_serialize(u, f, fds)) < 0) { - m->n_serializing --; + m->n_reloading --; return r; } } - assert(m->n_serializing > 0); - m->n_serializing --; + assert(m->n_reloading > 0); + m->n_reloading --; if (ferror(f)) return -EIO; @@ -2708,7 +2708,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { log_debug("Deserializing state..."); - m->n_deserializing ++; + m->n_reloading ++; for (;;) { char line[LINE_MAX], *l; @@ -2781,8 +2781,8 @@ finish: goto finish; } - assert(m->n_deserializing > 0); - m->n_deserializing --; + assert(m->n_reloading > 0); + m->n_reloading --; return r; } @@ -2797,21 +2797,21 @@ int manager_reload(Manager *m) { if ((r = manager_open_serialization(m, &f)) < 0) return r; - m->n_serializing ++; + m->n_reloading ++; if (!(fds = fdset_new())) { - m->n_serializing --; + m->n_reloading --; r = -ENOMEM; goto finish; } if ((r = manager_serialize(m, f, fds)) < 0) { - m->n_serializing --; + m->n_reloading --; goto finish; } if (fseeko(f, 0, SEEK_SET) < 0) { - m->n_serializing --; + m->n_reloading --; r = -errno; goto finish; } @@ -2820,9 +2820,6 @@ int manager_reload(Manager *m) { manager_clear_jobs_and_units(m); manager_undo_generators(m); - assert(m->n_serializing > 0); - m->n_serializing --; - /* Find new unit paths */ lookup_paths_free(&m->lookup_paths); if ((q = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0) @@ -2832,8 +2829,6 @@ int manager_reload(Manager *m) { manager_build_unit_path_cache(m); - m->n_deserializing ++; - /* First, enumerate what we can from all config files */ if ((q = manager_enumerate(m)) < 0) r = q; @@ -2849,8 +2844,8 @@ int manager_reload(Manager *m) { if ((q = manager_coldplug(m)) < 0) r = q; - assert(m->n_deserializing > 0); - m->n_deserializing--; + assert(m->n_reloading > 0); + m->n_reloading--; finish: if (f) |