]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
imds-generator: do not enable IMDS logic if detect_container() failed
authorMike Yuan <me@yhndnzj.com>
Thu, 26 Mar 2026 17:45:47 +0000 (18:45 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 25 Jul 2026 10:37:47 +0000 (19:37 +0900)
src/imds/imds-generator.c

index 933af90a631f75041fa59063afc2156b29a20730..ccef9fa36c0cce17f9cefdb4994350558754feb1 100644 (file)
@@ -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;