1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

os-util: accept SUPPORT_END= with empty string as explicit way to disable concept

This commit is contained in:
Lennart Poettering 2023-01-23 13:15:27 +01:00
parent 469af08f58
commit a9bd4b4ed9

View File

@ -349,14 +349,14 @@ int os_release_support_ended(const char *support_end, bool quiet) {
if (r < 0 && r != -ENOENT) if (r < 0 && r != -ENOENT)
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, r, return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, r,
"Failed to read os-release file, ignoring: %m"); "Failed to read os-release file, ignoring: %m");
if (!_support_end_alloc)
return false; /* no end date defined */
support_end = _support_end_alloc; support_end = _support_end_alloc;
} }
struct tm tm = {}; if (isempty(support_end)) /* An empty string is a explicit way to say "no EOL exists" */
return false; /* no end date defined */
struct tm tm = {};
const char *k = strptime(support_end, "%Y-%m-%d", &tm); const char *k = strptime(support_end, "%Y-%m-%d", &tm);
if (!k || *k) if (!k || *k)
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, SYNTHETIC_ERRNO(EINVAL), return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, SYNTHETIC_ERRNO(EINVAL),