diff options
author | Warner Losh <imp@FreeBSD.org> | 2018-05-08 18:25:37 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2018-05-08 18:25:37 +0000 |
commit | 12f409ff75b3b0dccae21f3ce88fa2c8568f5446 (patch) | |
tree | 777bbc38b3b2a59d8c86b3e99173c9b3ca52131b /usr.sbin/efibootmgr/efibootmgr.c | |
parent | e7dfa7d8ab6fd4f6615c9af68831b23923966f8a (diff) | |
download | src-12f409ff75b3b0dccae21f3ce88fa2c8568f5446.tar.gz src-12f409ff75b3b0dccae21f3ce88fa2c8568f5446.zip |
Inline print_order(). It's used one palce.
Notes
Notes:
svn path=/head/; revision=333381
Diffstat (limited to 'usr.sbin/efibootmgr/efibootmgr.c')
-rw-r--r-- | usr.sbin/efibootmgr/efibootmgr.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index 89199ccfd0eb..0137fd9fb158 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -279,27 +279,6 @@ parse_args(int argc, char *argv[]) static void -print_order(void) -{ - uint32_t attrs; - uint8_t *data; - size_t size, i; - - if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) < 0) { - printf("BootOrder : Couldn't get value for BootOrder\n"); - return; - } - - if (size % 2 == 1) - errx(1, "Bad BootOrder variable: odd length"); - - printf("BootOrder : "); - for (i = 0; i < size; i += 2) - printf("%04x%s", le16dec(data + i), i == size - 2 ? "\n" : ", "); -} - - -static void read_vars(void) { @@ -808,7 +787,14 @@ print_boot_vars(bool verbose) if (ret > 0) { printf("Timeout : %d seconds\n", le16dec(data)); } - print_order(); + + if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) > 0) { + if (size % 2 == 1) + warn("Bad BootOrder variable: odd length %d", (int)size); + printf("BootOrder : "); + for (size_t i = 0; i < size; i += 2) + printf("%04x%s", le16dec(data + i), i == size - 2 ? "\n" : ", "); + } /* now we want to fetch 'em all fresh again * which possibly includes a newly created bootvar |