efivars: adjust location of variable attribute

I also thought about converting efi_set_variable() to use writev, but we don't
have loop_writev. I'm not sure if the loop around write here is important.
Coinceivably, it could make a difference it we were writing a long value.
The loop was introduced in b7749eb517, without
much comment unfortunately. So it doesn't seem worth the risk of changing this
to not use a loop, and writing loop_writev just for this also seems overkill.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-09-17 09:39:19 +02:00
parent 9db9d6806e
commit 4b97478979
+2 -2
View File
@@ -219,10 +219,10 @@ static int efi_verify_variable(const char *variable, uint32_t attr, const void *
int efi_set_variable(const char *variable, const void *value, size_t size) {
static const uint32_t attr = EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS;
struct var {
_cleanup_free_ struct var {
uint32_t attr;
char buf[];
} _packed_ * _cleanup_free_ buf = NULL;
} _packed_ *buf = NULL;
_cleanup_close_ int fd = -EBADF;
bool saved_flags_valid = false;
unsigned saved_flags;