Skip to content

Instantly share code, notes, and snippets.

00000000 4d 5a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |MZ..............|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 |................|
00000040 0e 1f ba 0e 00 b4 cd 09 21 b8 4c 01 54 68 65 20 |........!.L.The |
00000050 6f 6e 6c 79 20 77 69 6e 6e 69 6e 67 20 6d 6f 76 |only winning mov|
00000060 65 20 69 73 20 6e 6f 74 20 74 6f 20 70 6c 61 79 |e is not to play|
00000070 2e 0d 0d 0a 24 00 00 00 00 00 00 00 00 00 00 00 |....$...........|
00000080 50 45 00 00 64 86 02 00 00 00 00 00 00 00 00 00 |PE..d...........|
/**
Retrieves the magic value from the PE/COFF header.
@param Hdr The buffer in which to return the PE32, PE32+, or TE header.
@return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32
@return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+
**/
UINT16
fenchurch:~/devel/github.com/efibootmgr$ sudo ./src/efibootmgr/efibootmgr -c -b 001B -d /dev/sda -l '\EFI\fedora\rhshim.efi' -L foo
Could not prepare boot variable: No space left on device
diff --git a/src/efivarfs.c b/src/efivarfs.c
index 1c2fe04..0cb05ff 100644
--- a/src/efivarfs.c
+++ b/src/efivarfs.c
@@ -234,6 +234,8 @@ efivarfs_set_variable(efi_guid_t guid, const char *name, uin
#if 1
memcpy(buf, &attributes, sizeof (attributes));
memcpy(buf + sizeof (attributes), data, data_size);
+ errno = ENOSPC;
+ return -1;