From: Mike Yuan Date: Sat, 13 Jul 2024 16:47:41 +0000 (+0200) Subject: core/import-creds: use proc_cmdline_get_bool() X-Git-Tag: v257-rc1~905^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efa7a5cfe464bf7a46899b57c9ba26db3621e3c7;p=thirdparty%2Fsystemd.git core/import-creds: use proc_cmdline_get_bool() --- diff --git a/src/core/import-creds.c b/src/core/import-creds.c index 5709457408e..2603eab1d97 100644 --- a/src/core/import-creds.c +++ b/src/core/import-creds.c @@ -880,19 +880,14 @@ int import_credentials(void) { RET_GATHER(r, merge_credentials_trusted(received_creds_dir)); } else { - _cleanup_free_ char *v = NULL; + bool import; - r = proc_cmdline_get_key("systemd.import_credentials", PROC_CMDLINE_STRIP_RD_PREFIX, &v); + r = proc_cmdline_get_bool("systemd.import_credentials", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &import); if (r < 0) - log_debug_errno(r, "Failed to check if 'systemd.import_credentials=' kernel command line option is set, ignoring: %m"); - else if (r > 0) { - r = parse_boolean(v); - if (r < 0) - log_debug_errno(r, "Failed to parse 'systemd.import_credentials=' parameter, ignoring: %m"); - else if (r == 0) { - log_notice("systemd.import_credentials=no is set, skipping importing of credentials."); - return 0; - } + log_debug_errno(r, "Failed to check systemd.import_credentials= kernel command line option, proceeding: %m"); + else if (!import) { + log_notice("systemd.import_credentials=no is set, skipping importing of credentials."); + return 0; } r = import_credentials_boot();