]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efivars: seek back to beginning in each efi_get_variable() loop
authorLennart Poettering <lennart@poettering.net>
Thu, 13 Nov 2025 11:35:36 +0000 (12:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 13 Nov 2025 13:19:29 +0000 (14:19 +0100)
We try to read again from the beginning, hence let's seek back.
Apparently efivarfs doesn't strictly require this, but it's really weird
that it doesn't.

src/basic/efivars.c

index f40c8a09e01ba6a7b2f07b25be659f0aab63410e..f54c3d22e93d8433739d282e98e03dfebd3e67e0 100644 (file)
@@ -114,6 +114,9 @@ int efi_get_variable(
                         return log_debug_errno(SYNTHETIC_ERRNO(EBUSY), "Reading EFI variable '%s' failed even after %u tries, giving up.", p, try);
                 if (try >= EFI_N_RETRIES_NO_DELAY)
                         (void) usleep_safe(EFI_RETRY_DELAY);
+
+                /* Start from the beginning */
+                (void) lseek(fd, 0, SEEK_SET);
         }
 
         /* Unfortunately kernel reports EOF if there's an inconsistency between efivarfs var list and