diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-01-23 13:16:12 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-01-24 15:32:43 +0100 |
commit | 6bfe9b3b8d9c208d17ba76bc93ae075afef0ae69 (patch) | |
tree | fe2163008dbe836663db7585ab474bc1900c8299 /src/basic/os-util.c | |
parent | os-util: accept SUPPORT_END= with empty string as explicit way to disable con... (diff) | |
download | systemd-6bfe9b3b8d9c208d17ba76bc93ae075afef0ae69.tar.xz systemd-6bfe9b3b8d9c208d17ba76bc93ae075afef0ae69.zip |
os-util: optionally, return EOL time in os_release_support_ended()
Diffstat (limited to 'src/basic/os-util.c')
-rw-r--r-- | src/basic/os-util.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/basic/os-util.c b/src/basic/os-util.c index 3b50279a44..37a4ac1fe4 100644 --- a/src/basic/os-util.c +++ b/src/basic/os-util.c @@ -336,7 +336,7 @@ int load_extension_release_pairs(const char *root, const char *extension, bool r return load_env_file_pairs(f, p, ret); } -int os_release_support_ended(const char *support_end, bool quiet) { +int os_release_support_ended(const char *support_end, bool quiet, usec_t *ret_eol) { _cleanup_free_ char *_support_end_alloc = NULL; int r; @@ -367,8 +367,10 @@ int os_release_support_ended(const char *support_end, bool quiet) { return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, SYNTHETIC_ERRNO(EINVAL), "Failed to convert SUPPORT_END= in os-release file, ignoring: %m"); - usec_t ts = now(CLOCK_REALTIME); - return DIV_ROUND_UP(ts, USEC_PER_SEC) > (usec_t) eol; + if (ret_eol) + *ret_eol = eol * USEC_PER_SEC; + + return DIV_ROUND_UP(now(CLOCK_REALTIME), USEC_PER_SEC) > (usec_t) eol; } const char *os_release_pretty_name(const char *pretty_name, const char *name) { |