diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-05-27 15:16:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-27 15:16:24 +0200 |
commit | 49d5aae503f86c61c9e8325c86494431fcf8ca98 (patch) | |
tree | 93b72d73e2f75fcbd6f97416963986d841ff8127 /src | |
parent | Merge pull request #15928 from poettering/kill-mode-warnings (diff) | |
parent | shared/efi-loader: remove check that uses absolute tick value (diff) | |
download | systemd-49d5aae503f86c61c9e8325c86494431fcf8ca98.tar.xz systemd-49d5aae503f86c61c9e8325c86494431fcf8ca98.zip |
Merge pull request #15934 from keszybz/docs-and-test-fix
A few sundry documentation and code fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/core/load-fragment.c | 2 | ||||
-rw-r--r-- | src/core/main.c | 2 | ||||
-rw-r--r-- | src/core/manager.c | 27 | ||||
-rw-r--r-- | src/shared/efi-loader.c | 6 | ||||
-rw-r--r-- | src/userdb/userwork.c | 2 |
5 files changed, 11 insertions, 28 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 96a3f12103..a967627946 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -4823,7 +4823,7 @@ int unit_load_fragment(Unit *u) { &u->manager->unit_name_map, &u->manager->unit_path_cache); if (r < 0) - log_error_errno(r, "Failed to rebuild name map: %m"); + return log_error_errno(r, "Failed to rebuild name map: %m"); r = unit_file_find_fragment(u->manager->unit_id_map, u->manager->unit_name_map, diff --git a/src/core/main.c b/src/core/main.c index 30e1b3d19d..5dda164fef 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -517,7 +517,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat } else if (!value) { const char *target; - /* SysV compatibility */ + /* Compatible with SysV, but supported independently even if SysV compatiblity is disabled. */ target = runlevel_to_target(key); if (target) return free_and_strdup_warn(&arg_default_unit, target); diff --git a/src/core/manager.c b/src/core/manager.c index ac5a3b6805..f15f845e81 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -679,18 +679,12 @@ static int manager_setup_prefix(Manager *m) { [EXEC_DIRECTORY_CONFIGURATION] = { SD_PATH_USER_CONFIGURATION, NULL }, }; - const struct table_entry *p; - ExecDirectoryType i; - int r; - assert(m); - if (MANAGER_IS_SYSTEM(m)) - p = paths_system; - else - p = paths_user; + const struct table_entry *p = MANAGER_IS_SYSTEM(m) ? paths_system : paths_user; + int r; - for (i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++) { + for (ExecDirectoryType i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++) { r = sd_path_lookup(p[i].type, p[i].suffix, &m->prefix[i]); if (r < 0) return r; @@ -1344,15 +1338,12 @@ static void manager_clear_jobs_and_units(Manager *m) { } Manager* manager_free(Manager *m) { - ExecDirectoryType dt; - UnitType c; - if (!m) return NULL; manager_clear_jobs_and_units(m); - for (c = 0; c < _UNIT_TYPE_MAX; c++) + for (UnitType c = 0; c < _UNIT_TYPE_MAX; c++) if (unit_vtable[c]->shutdown) unit_vtable[c]->shutdown(m); @@ -1423,22 +1414,20 @@ Manager* manager_free(Manager *m) { hashmap_free(m->uid_refs); hashmap_free(m->gid_refs); - for (dt = 0; dt < _EXEC_DIRECTORY_TYPE_MAX; dt++) + for (ExecDirectoryType dt = 0; dt < _EXEC_DIRECTORY_TYPE_MAX; dt++) m->prefix[dt] = mfree(m->prefix[dt]); return mfree(m); } static void manager_enumerate_perpetual(Manager *m) { - UnitType c; - assert(m); if (m->test_run_flags == MANAGER_TEST_RUN_MINIMAL) return; /* Let's ask every type to load all units from disk/kernel that it might know */ - for (c = 0; c < _UNIT_TYPE_MAX; c++) { + for (UnitType c = 0; c < _UNIT_TYPE_MAX; c++) { if (!unit_type_supported(c)) { log_debug("Unit type .%s is not supported on this system.", unit_type_to_string(c)); continue; @@ -1450,15 +1439,13 @@ static void manager_enumerate_perpetual(Manager *m) { } static void manager_enumerate(Manager *m) { - UnitType c; - assert(m); if (m->test_run_flags == MANAGER_TEST_RUN_MINIMAL) return; /* Let's ask every type to load all units from disk/kernel that it might know */ - for (c = 0; c < _UNIT_TYPE_MAX; c++) { + for (UnitType c = 0; c < _UNIT_TYPE_MAX; c++) { if (!unit_type_supported(c)) { log_debug("Unit type .%s is not supported on this system.", unit_type_to_string(c)); continue; diff --git a/src/shared/efi-loader.c b/src/shared/efi-loader.c index 34196537b7..c288176fd1 100644 --- a/src/shared/efi-loader.c +++ b/src/shared/efi-loader.c @@ -531,15 +531,11 @@ int efi_loader_get_boot_usec(usec_t *firmware, usec_t *loader) { if (r < 0) return log_debug_errno(r, "Failed to read LoaderTimeExecUSec: %m"); - if (y == 0 || y < x) + if (y == 0 || y < x || y - x > USEC_PER_HOUR) return log_debug_errno(SYNTHETIC_ERRNO(EIO), "Bad LoaderTimeInitUSec=%"PRIu64", LoaderTimeExecUSec=%" PRIu64"; refusing.", x, y); - if (y > USEC_PER_HOUR) - return log_debug_errno(SYNTHETIC_ERRNO(EIO), - "LoaderTimeExecUSec=%"PRIu64" too large, refusing.", x); - *firmware = x; *loader = y; diff --git a/src/userdb/userwork.c b/src/userdb/userwork.c index 5a8fc81922..ac04af0ca8 100644 --- a/src/userdb/userwork.c +++ b/src/userdb/userwork.c @@ -724,7 +724,7 @@ static int run(int argc, char *argv[]) { last_busy_usec = n; else if (listen_idle_usec != USEC_INFINITY && n >= usec_add(last_busy_usec, listen_idle_usec)) { char buf[FORMAT_TIMESPAN_MAX]; - log_debug("Exiting worker, been idle for %s, .", + log_debug("Exiting worker, been idle for %s.", format_timespan(buf, sizeof(buf), usec_sub_unsigned(n, last_busy_usec), 0)); break; } |