Skip to content

Commit 90e88b2

Browse files
ozbenhvathpela
authored andcommitted
Allow -a to create a non-existent variable
There is no much point in failing when trying to append, we may as well create the variable. This way it can be used for dbx update payloads that must be applied in append mode even if there isn't a dbx yet. This is nicer than using -w with EFI_VARIABLE_APPEND_WRITE added to the attributes passed with -A Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent 9306e0b commit 90e88b2

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/efivar.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,8 @@ edit_variable(const char *guid_name, void *data, size_t data_size,
355355
exit(1);
356356
}
357357

358-
rc = efi_get_variable(guid, name, &old_data, &old_data_size,
359-
&old_attributes);
360-
if (rc < 0 && edit_type != EDIT_WRITE) {
361-
fprintf(stderr, "efivar: %m\n");
362-
show_errors();
363-
exit(1);
364-
}
365-
358+
rc = efi_get_variable(guid, name, &old_data, &old_data_size, &old_attributes);
359+
/* Ignore errors, as -a can be used to create a variable */
366360
if (attrib != 0)
367361
old_attributes = attrib;
368362

0 commit comments

Comments
 (0)