From 422d8905c0c01170ab5c196f0c4db1d554c83f64 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 19 Dec 2023 12:06:00 +0900 Subject: [PATCH] find-esp: add debugging log about failure in parsing env variable Addresses https://github.com/systemd/systemd/pull/30321#discussion_r1429716344. --- src/shared/find-esp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/find-esp.c b/src/shared/find-esp.c index bbfd3b175f3..db87084a4da 100644 --- a/src/shared/find-esp.c +++ b/src/shared/find-esp.c @@ -33,6 +33,7 @@ typedef enum VerifyESPFlags { static VerifyESPFlags verify_esp_flags_init(int unprivileged_mode, const char *env_name_for_relaxing) { VerifyESPFlags flags = 0; + int r; assert(env_name_for_relaxing); @@ -41,7 +42,10 @@ static VerifyESPFlags verify_esp_flags_init(int unprivileged_mode, const char *e if (unprivileged_mode) flags |= VERIFY_ESP_UNPRIVILEGED_MODE; - if (getenv_bool(env_name_for_relaxing) > 0) + r = getenv_bool(env_name_for_relaxing); + if (r < 0 && r != -ENXIO) + log_debug_errno(r, "Failed to parse $%s environment variable, assuming false.", env_name_for_relaxing); + else if (r > 0) flags |= VERIFY_ESP_SKIP_FSTYPE_CHECK | VERIFY_ESP_SKIP_DEVICE_CHECK; if (detect_container() > 0)