Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168315090
D18648.id52280.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D18648.id52280.diff
View Options
Index: usr.sbin/efibootmgr/efibootmgr.c
===================================================================
--- usr.sbin/efibootmgr/efibootmgr.c
+++ usr.sbin/efibootmgr/efibootmgr.c
@@ -94,7 +94,7 @@
} bmgr_opts_t;
static struct option lopts[] = {
- {"activate", required_argument, NULL, 'a'},
+ {"activate", no_argument, NULL, 'a'},
{"bootnext", required_argument, NULL, 'n'}, /* set bootnext */
{"bootnum", required_argument, NULL, 'b'},
{"bootorder", required_argument, NULL, 'o'}, /* set order */
@@ -171,37 +171,35 @@
#define USAGE \
- " [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help] \n\
- [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar]]"
+ " [-aAnB -b bootnum] [-N] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help]\n\
+ [-c -l loader [-k kernel] [-L label] [--dry-run] [-b bootnum]]"
#define CREATE_USAGE \
- " efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run]"
+ " efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run] [-b bootnum]"
#define ORDER_USAGE \
" efibootmgr -o bootvarnum1,bootvarnum2,..."
#define TIMEOUT_USAGE \
" efibootmgr -t seconds"
#define DELETE_USAGE \
- " efibootmgr -B bootvarnum"
+ " efibootmgr -B -b bootnum"
#define ACTIVE_USAGE \
- " efibootmgr [-a | -A] bootvarnum"
+ " efibootmgr [-a | -A] -b bootnum"
#define BOOTNEXT_USAGE \
- " efibootmgr [-n | -N] bootvarnum"
+ " efibootmgr [-n | -N] -b bootnum"
static void
parse_args(int argc, char *argv[])
{
int ch;
- while ((ch = getopt_long(argc, argv, "A:a:B:b:C:cDe:hk:L:l:Nn:Oo:Tt:v",
+ while ((ch = getopt_long(argc, argv, "AaBb:C:cDe:hk:L:l:NnOo:Tt:v",
lopts, NULL)) != -1) {
switch (ch) {
case 'A':
opts.set_inactive = true;
- opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'a':
opts.set_active = true;
- opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'b':
opts.has_bootnum = true;
@@ -209,7 +207,6 @@
break;
case 'B':
opts.delete = true;
- opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'C':
opts.copy = true;
@@ -246,7 +243,6 @@
break;
case 'n':
opts.set_bootnext = true;
- opts.bootnum = strtoul(optarg, NULL, 16);
break;
case 'O':
opts.once = true;
@@ -357,6 +353,9 @@
size_t size;
char *name;
+ if (bootnum < 0 || bootnum > 0xffff)
+ errx(1, "Need to specify a valid bootnum between 0 and FFFF with -b parameter");
+
asprintf(&name, "%s%04X", "Boot", bootnum);
if (name == NULL)
err(1, "asprintf");
@@ -490,10 +489,13 @@
}
static void
-handle_bootnext(uint16_t bootnum)
+handle_bootnext(int bootnum)
{
uint16_t num;
+ if (bootnum < 0 || bootnum > 0xFFFF)
+ errx(1, "Need to specify a valid bootnum between 0 and FFFF with -b parameter.");
+
le16enc(&num, bootnum);
if (set_bootvar("BootNext", (uint8_t*)&bootnum, sizeof(uint16_t)) < 0)
err(1, "set_bootvar");
@@ -909,6 +911,7 @@
errx(1, "efi variables not supported on this system. root? kldload efirt?");
memset(&opts, 0, sizeof (bmgr_opts_t));
+ opts.bootnum = -1;
parse_args(argc, argv);
read_vars();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 28, 2:25 PM (5 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37317300
Default Alt Text
D18648.id52280.diff (3 KB)
Attached To
Mode
D18648: Change the way efibootmgr works by specifying bootnum via -b parameter
Attached
Detach File
Event Timeline
Log In to Comment