From: Mike Yuan Date: Thu, 26 Mar 2026 17:45:47 +0000 (+0100) Subject: imds-generator: do not enable IMDS logic if detect_container() failed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c98dac0dcdb711de337ecb10bee6f1704d85854;p=thirdparty%2Fsystemd.git imds-generator: do not enable IMDS logic if detect_container() failed --- diff --git a/src/imds/imds-generator.c b/src/imds/imds-generator.c index 933af90a631..ccef9fa36c0 100644 --- a/src/imds/imds-generator.c +++ b/src/imds/imds-generator.c @@ -136,7 +136,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) if (arg_enabled < 0) { Virtualization v = detect_container(); if (v < 0) - log_debug_errno(v, "Container detection failed, ignoring: %m"); + return log_error_errno(v, "Container detection failed: %m"); if (v > 0) { log_debug("Running in a container, disabling IMDS logic."); arg_enabled = false; @@ -148,6 +148,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) } } + assert(arg_enabled >= 0); if (!arg_enabled) { log_debug("IMDS not enabled, skipping generator."); return 0;