import-creds: when we hit ENOENT on SMBIOS 11 do not even debug log
authorLennart Poettering <lennart@poettering.net>
Thu, 11 Jul 2024 12:32:09 +0000 (14:32 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 22 Jul 2024 12:27:30 +0000 (14:27 +0200)
We'll *always* hit ENEOENT when iterating through SMBIOS type #11
fields, on the last one. it's very confusing to debug log about that,
let's just not do it.

(cherry picked from commit 5202ee42d5da0ae3a6655d2bc959a19d8c347e9d)

src/core/import-creds.c

index f27ffed4a0d50765eb439d20716ce6088299f137..e6cf40d5ec6ecf8faf1de57bc81cbb87ebf10959 100644 (file)
@@ -595,9 +595,11 @@ static int import_credentials_smbios(ImportCredentialContext *c) {
                         return log_oom();
 
                 r = read_virtual_file(p, sizeof(dmi_field_header) + CREDENTIALS_TOTAL_SIZE_MAX, (char**) &data, &size);
+                if (r == -ENOENT) /* Once we reach ENOENT there are no more DMI Type 11 fields around. */
+                        break;
                 if (r < 0) {
                         /* Once we reach ENOENT there are no more DMI Type 11 fields around. */
-                        log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r, "Failed to open '%s', ignoring: %m", p);
+                        log_warning_errno(r, "Failed to open '%s', ignoring: %m", p);
                         break;
                 }