Skip to content

Commit

Permalink
efibootmgr: Make device paths print by default; make verbose help deb…
Browse files Browse the repository at this point in the history
…ug them.

This makes the blank "efibootmgr" invocation behave like:

rainbowpass:~$ ./efibootmgr
BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 000F,0003,000D,0000,0001,0002,0004,0005,0006,0007,0008,0009,000A,000B,000C,000E,0012,0010
Boot0000* Enter Setup	FvVol(cdbb7b35-6833-4ed6-9ab2-57d2acddf6f0)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI Internal Shell	FvVol(cdbb7b35-6833-4ed6-9ab2-57d2acddf6f0)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
Boot0002  Boot Device List	FvVol(cdbb7b35-6833-4ed6-9ab2-57d2acddf6f0)/FvFile(eec25bdc-67f2-4d95-b1d5-f81b2039d11d)
Boot0003* Fedora	HD(1,GPT,6584272a-d7b9-442a-b8a4-19b5ec4566f4,0x800,0x64000)/File(\EFI\fedora\shimx64.efi)
Boot0004* UEFI ATAPI iHAS324 E 3524706 2B8427502710	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(1,65535,0)N.....YM....R,Y.
Boot0005* UEFI ST500DM002-1BD142 Z6E8345H	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0)N.....YM....R,Y.
Boot0006* UEFI PXEv4 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv4(0.0.0.00.0.0.0,0,0)N.....YM....R,Y.
Boot0007* UEFI HTTPv4 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv4(0.0.0.00.0.0.0,0,0)/Uri()N.....YM....R,Y.
Boot0008* UEFI PXEv6 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv6([::]:<->[::]:,0,0)N.....YM....R,Y.
Boot0009* UEFI HTTPv6 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv6([::]:<->[::]:,0,0)/Uri()N.....YM....R,Y.
Boot000A* UEFI PXEv4 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv4(0.0.0.00.0.0.0,0,0)N.....YM....R,Y.
Boot000B* UEFI HTTPv4 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv4(0.0.0.00.0.0.0,0,0)/Uri()N.....YM....R,Y.
Boot000C* UEFI PXEv6 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv6([::]:<->[::]:,0,0)N.....YM....R,Y.
Boot000D* Test	HD(1,GPT,6584272a-d7b9-442a-b8a4-19b5ec4566f4,0x800,0x64000)/File(\EFI\test\shimx64.efi)
Boot000E* UEFI HTTPv6 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv6([::]:<->[::]:,0,0)/Uri()N.....YM....R,Y.
Boot000F* install media	HD(1,MBR,0x7b9be8ed,0x0,0x10a800)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0010* UEFI Lexar USB Flash Drive AAINZVH8Z5X69E5Z	PciRoot(0x0)/Pci(0x1d,0x0)/USB(0,0)/USB(2,0)N.....YM....R,Y.
Boot0011* net-test	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv4(0.0.0.00.0.0.0,0,0)
Boot0012* UEFI ST32000542AS 6XW02W32	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(3,65535,0)N.....YM....R,Y.

And makes the verbose invocation help us debug device paths:

rainbowpass:~$ ./efibootmgr  -v
BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 000F,0003,000D,0000,0001,0002,0004,0005,0006,0007,0008,0009,000A,000B,000C,000E,0012,0010
Boot0000* Enter Setup	FvVol(cdbb7b35-6833-4ed6-9ab2-57d2acddf6f0)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
      dp: 04 07 14 00 35 7b bb cd 33 68 d6 4e 9a b2 57 d2 ac dd f6 f0 / 04 06 14 00 21 aa 2c 46 14 76 03 45 83 6e 8a b6 f4 66 23 31 / 7f ff 04 00
Boot0001* UEFI Internal Shell	FvVol(cdbb7b35-6833-4ed6-9ab2-57d2acddf6f0)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
      dp: 04 07 14 00 35 7b bb cd 33 68 d6 4e 9a b2 57 d2 ac dd f6 f0 / 04 06 14 00 83 a5 04 7c 3e 9e 1c 4f ad 65 e0 52 68 d0 b4 d1 / 7f ff 04 00
Boot0002  Boot Device List	FvVol(cdbb7b35-6833-4ed6-9ab2-57d2acddf6f0)/FvFile(eec25bdc-67f2-4d95-b1d5-f81b2039d11d)
      dp: 04 07 14 00 35 7b bb cd 33 68 d6 4e 9a b2 57 d2 ac dd f6 f0 / 04 06 14 00 dc 5b c2 ee f2 67 95 4d b1 d5 f8 1b 20 39 d1 1d / 7f ff 04 00
Boot0003* Fedora	HD(1,GPT,6584272a-d7b9-442a-b8a4-19b5ec4566f4,0x800,0x64000)/File(\EFI\fedora\shimx64.efi)
      dp: 04 01 2a 00 01 00 00 00 00 08 00 00 00 00 00 00 00 40 06 00 00 00 00 00 2a 27 84 65 b9 d7 2a 44 b8 a4 19 b5 ec 45 66 f4 02 02 / 04 04 34 00 5c 00 45 00 46 00 49 00 5c 00 66 00 65 00 64 00 6f 00 72 00 61 00 5c 00 73 00 68 00 69 00 6d 00 78 00 36 00 34 00 2e 00 65 00 66 00 69 00 00 00 / 7f ff 04 00
Boot0004* UEFI ATAPI iHAS324 E 3524706 2B8427502710	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(1,65535,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1f / 03 12 0a 00 01 00 ff ff 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot0005* UEFI ST500DM002-1BD142 Z6E8345H	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1f / 03 12 0a 00 00 00 ff ff 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot0006* UEFI PXEv4 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv4(0.0.0.00.0.0.0,0,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 01 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0c 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot0007* UEFI HTTPv4 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv4(0.0.0.00.0.0.0,0,0)/Uri()N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 01 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0c 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 03 18 04 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot0008* UEFI PXEv6 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv6([::]:<->[::]:,0,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 01 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0d 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot0009* UEFI HTTPv6 (MAC:001E67AD5E66)	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv6([::]:<->[::]:,0,0)/Uri()N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 01 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0d 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 03 18 04 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot000A* UEFI PXEv4 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv4(0.0.0.00.0.0.0,0,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0c 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot000B* UEFI HTTPv4 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv4(0.0.0.00.0.0.0,0,0)/Uri()N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0c 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 03 18 04 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot000C* UEFI PXEv6 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv6([::]:<->[::]:,0,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0d 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot000D* Test	HD(1,GPT,6584272a-d7b9-442a-b8a4-19b5ec4566f4,0x800,0x64000)/File(\EFI\test\shimx64.efi)
      dp: 04 01 2a 00 01 00 00 00 00 08 00 00 00 00 00 00 00 40 06 00 00 00 00 00 2a 27 84 65 b9 d7 2a 44 b8 a4 19 b5 ec 45 66 f4 02 02 / 04 04 30 00 5c 00 45 00 46 00 49 00 5c 00 74 00 65 00 73 00 74 00 5c 00 73 00 68 00 69 00 6d 00 78 00 36 00 34 00 2e 00 65 00 66 00 69 00 00 00 / 7f ff 04 00
Boot000E* UEFI HTTPv6 (MAC:001E67AD5E67)	PciRoot(0x0)/Pci(0x1c,0x2)/Pci(0x0,0x0)/MAC(001e67ad5e67,1)/IPv6([::]:<->[::]:,0,0)/Uri()N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0d 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 03 18 04 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot000F* install media	HD(1,MBR,0x7b9be8ed,0x0,0x10a800)/File(\EFI\BOOT\BOOTX64.EFI)
      dp: 04 01 2a 00 01 00 00 00 00 00 00 00 00 00 00 00 00 a8 10 00 00 00 00 00 ed e8 9b 7b 00 00 00 00 00 00 00 00 00 00 00 00 01 01 / 04 04 30 00 5c 00 45 00 46 00 49 00 5c 00 42 00 4f 00 4f 00 54 00 5c 00 42 00 4f 00 4f 00 54 00 58 00 36 00 34 00 2e 00 45 00 46 00 49 00 00 00 / 7f ff 04 00
Boot0010* UEFI Lexar USB Flash Drive AAINZVH8Z5X69E5Z	PciRoot(0x0)/Pci(0x1d,0x0)/USB(0,0)/USB(2,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 00 1d / 03 05 06 00 00 00 / 03 05 06 00 02 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2
Boot0011* net-test	PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)/MAC(001e67ad5e66,1)/IPv4(0.0.0.00.0.0.0,0,0)
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 01 1c / 01 01 06 00 00 00 / 03 0b 25 00 00 1e 67 ad 5e 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 / 03 0c 1b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 / 7f ff 04 00
Boot0012* UEFI ST32000542AS 6XW02W32	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(3,65535,0)N.....YM....R,Y.
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 02 1f / 03 12 0a 00 03 00 ff ff 00 00 / 7f ff 04 00
    data: 4e ac 08 81 11 9f 59 4d 85 0e e2 1a 52 2c 59 b2

Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Mar 6, 2019
1 parent 99b5785 commit 8ec3e9d
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 71 deletions.
161 changes: 96 additions & 65 deletions src/efibootmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,16 +916,102 @@ ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
return strdup(ret);
}

static void
show_var_path(efi_load_option *load_option, size_t boot_data_size)
{
char *text_path = NULL;
size_t text_path_len = 0;
uint16_t pathlen;
ssize_t rc;

efidp dp = NULL;
unsigned char *optional_data = NULL;
size_t optional_data_len=0;

pathlen = efi_loadopt_pathlen(load_option,
boot_data_size);
dp = efi_loadopt_path(load_option, boot_data_size);
rc = efidp_format_device_path(text_path, text_path_len,
dp, pathlen);
if (rc < 0)
error(18, "Could not parse device path");
rc += 1;

text_path_len = rc;
text_path = calloc(1, rc);
if (!text_path)
error(19, "Could not parse device path");

rc = efidp_format_device_path(text_path, text_path_len,
dp, pathlen);
if (rc < 0)
error(20, "Could not parse device path");
printf("\t%s", text_path);
free(text_path);
/* Print optional data */

rc = efi_loadopt_optional_data(load_option, boot_data_size,
&optional_data, &optional_data_len);
if (rc < 0)
error(21, "Could not parse optional data");

if (opts.unicode) {
text_path = ucs2_to_utf8((uint16_t*)optional_data,
optional_data_len/2);
} else {
rc = unparse_raw_text(NULL, 0, optional_data,
optional_data_len);
if (rc < 0)
error(22, "Could not parse optional data");
rc += 1;
text_path_len = rc;
text_path = calloc(1, rc);
if (!text_path)
error(23, "Could not parse optional data");
rc = unparse_raw_text(text_path, text_path_len,
optional_data, optional_data_len);
if (rc < 0)
error(24, "Could not parse device path");
}
printf("%s", text_path);
free(text_path);
printf("\n");

const_efidp node = dp;
if (opts.verbose >= 1)
printf(" dp: ");
for (rc = 1; opts.verbose >= 1 && rc > 0; ) {
ssize_t sz;
const_efidp next = NULL;
const uint8_t * const data = (const uint8_t * const)node;

rc = efidp_next_node(node, &next);
if (rc < 0)
error(25, "Could not iterate device path");

sz = efidp_node_size(node);
if (sz <= 0)
error(25, "Could not iterate device path");

for (ssize_t j = 0; j < sz; j++)
printf("%02hhx%s", data[j], j == sz - 1 ? "" : " ");
printf("%s", rc == 0 ? "\n" : " / ");

node = next;
}
if (opts.verbose >= 1 && optional_data_len)
printf(" data: ");
for (unsigned int j = 0; opts.verbose >= 1 && j < optional_data_len; j++)
printf("%02hhx%s", optional_data[j], j == optional_data_len - 1 ? "\n" : " ");
}

static void
show_vars(const char *prefix)
{
list_t *pos;
var_entry_t *boot;
const unsigned char *description;
efi_load_option *load_option;
efidp dp = NULL;
unsigned char *optional_data = NULL;
size_t optional_data_len=0;

list_for_each(pos, &entry_list) {
boot = list_entry(pos, var_entry_t, list);
Expand All @@ -940,62 +1026,8 @@ show_vars(const char *prefix)
& LOAD_OPTION_ACTIVE) ? '*' : ' ');
printf("%s", description);

if (opts.verbose) {
char *text_path = NULL;
size_t text_path_len = 0;
uint16_t pathlen;
ssize_t rc;

pathlen = efi_loadopt_pathlen(load_option,
boot->data_size);
dp = efi_loadopt_path(load_option, boot->data_size);
rc = efidp_format_device_path(text_path, text_path_len,
dp, pathlen);
if (rc < 0)
error(18, "Could not parse device path");
rc += 1;

text_path_len = rc;
text_path = calloc(1, rc);
if (!text_path)
error(19, "Could not parse device path");

rc = efidp_format_device_path(text_path, text_path_len,
dp, pathlen);
if (rc < 0)
error(20, "Could not parse device path");
printf("\t%s", text_path);
free(text_path);
/* Print optional data */

rc = efi_loadopt_optional_data(load_option,
boot->data_size,
&optional_data,
&optional_data_len);
if (rc < 0)
error(21, "Could not parse optional data");

if (opts.unicode) {
text_path = ucs2_to_utf8((uint16_t*)optional_data, optional_data_len/2);
} else {
rc = unparse_raw_text(NULL, 0, optional_data,
optional_data_len);
if (rc < 0)
error(22, "Could not parse optional data");
rc += 1;
text_path_len = rc;
text_path = calloc(1, rc);
if (!text_path)
error(23, "Could not parse optional data");
rc = unparse_raw_text(text_path, text_path_len,
optional_data, optional_data_len);
if (rc < 0)
error(24, "Could not parse device path");
}
printf("%s", text_path);
free(text_path);
}
printf("\n");
show_var_path(load_option, boot->data_size);

fflush(stdout);
}
}
Expand Down Expand Up @@ -1372,7 +1404,7 @@ parse_opts(int argc, char **argv)
- (intptr_t)optarg;
print_error_arrow(optarg, offset,
"Invalid bootnum value");
conditional_error_reporter(opts.verbose >= 2,
conditional_error_reporter(opts.verbose >= 1,
1);
exit(28);
}
Expand Down Expand Up @@ -1475,7 +1507,7 @@ parse_opts(int argc, char **argv)
- (intptr_t)optarg;
print_error_arrow(optarg, offset,
"Invalid BootNext value");
conditional_error_reporter(opts.verbose >= 2,
conditional_error_reporter(opts.verbose >= 1,
1);
exit(35);
}
Expand Down Expand Up @@ -1525,9 +1557,9 @@ parse_opts(int argc, char **argv)
opts.verbose += 1;
if (optarg) {
if (!strcmp(optarg, "v"))
opts.verbose = 2;
opts.verbose = 1;
if (!strcmp(optarg, "vv"))
opts.verbose = 3;
opts.verbose = 2;
rc = sscanf(optarg, "%u", &num);
if (rc == 1)
opts.verbose = num;
Expand All @@ -1536,7 +1568,7 @@ parse_opts(int argc, char **argv)
"invalid numeric value %s\n",
optarg);
}
efi_set_verbose(opts.verbose - 2, stderr);
efi_set_verbose(opts.verbose - 1, stderr);
break;
case 'V':
opts.showversion = 1;
Expand Down Expand Up @@ -1748,4 +1780,3 @@ main(int argc, char **argv)
return 1;
return 0;
}

12 changes: 6 additions & 6 deletions src/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cond_error(int test, int eval, const char *fmt, ...)
vfprintf(stderr, fmt, ap);
errno = saved_errno;
fprintf(stderr, ": %m\n");
conditional_error_reporter(verbose >= 2, 0);
conditional_error_reporter(verbose >= 1, 0);
va_end(ap);
exit(eval);
}
Expand All @@ -99,7 +99,7 @@ error(int eval, const char *fmt, ...)
vfprintf(stderr, fmt, ap);
errno = saved_errno;
fprintf(stderr, ": %m\n");
conditional_error_reporter(verbose >= 2, 0);
conditional_error_reporter(verbose >= 1, 0);
va_end(ap);
exit(eval);
}
Expand All @@ -114,7 +114,7 @@ errorx(int eval, const char *fmt, ...)
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
conditional_error_reporter(verbose >= 2, 1);
conditional_error_reporter(verbose >= 1, 1);
va_end(ap);
exit(eval);
}
Expand All @@ -132,7 +132,7 @@ cond_warning(int test, const char *fmt, ...)
vprintf(fmt, ap);
errno = saved_errno;
printf(": %m\n");
conditional_error_reporter(verbose >= 2, 1);
conditional_error_reporter(verbose >= 1, 1);
va_end(ap);
}

Expand All @@ -147,7 +147,7 @@ warning(const char *fmt, ...)
vprintf(fmt, ap);
errno = saved_errno;
printf(": %m\n");
conditional_error_reporter(verbose >= 2, 1);
conditional_error_reporter(verbose >= 1, 1);
va_end(ap);
}

Expand All @@ -160,7 +160,7 @@ warningx(const char *fmt, ...)
va_start(ap, fmt);
vprintf(fmt, ap);
printf("\n");
conditional_error_reporter(verbose >= 2, 1);
conditional_error_reporter(verbose >= 1, 1);
va_end(ap);
}
#endif /* EFIBOOTMGR_ERROR_H__ */

0 comments on commit 8ec3e9d

Please sign in to comment.