Print this page
8226 missing boot environments cause bootadm list-menu to segfault
*** 24,33 ****
--- 24,34 ----
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 Toomas Soome <tsoome@me.com>
+ * Copyright 2017 RackTop Systems.
*/
/*
* Loader menu management.
*/
*** 180,215 ****
static void
print_menu_nodes(boolean_t parsable, struct hdr_info *hdr,
struct menu_lst *menu)
{
struct menu_entry *entry;
! int i = -1;
int rv;
be_node_list_t *be_nodes, *be_node;
rv = be_list(NULL, &be_nodes);
if (rv != BE_SUCCESS)
return;
STAILQ_FOREACH(entry, menu, next) {
! i++;
for (be_node = be_nodes; be_node;
be_node = be_node->be_next_node)
if (strcmp(be_node->be_root_ds, entry->bootfs) == 0)
! break;
if (parsable)
(void) printf("%d;%s;%s;%s\n", i,
! be_node->be_active_on_boot == B_TRUE? "*" : "-",
entry->bootfs, entry->title);
else
(void) printf("%-*d %-*s %-*s %-*s\n",
hdr->cols[0].width, i,
hdr->cols[1].width,
! be_node->be_active_on_boot == B_TRUE? "*" : "-",
hdr->cols[2].width, entry->bootfs,
hdr->cols[3].width, entry->title);
}
be_free_list(be_nodes);
}
static void
--- 181,220 ----
static void
print_menu_nodes(boolean_t parsable, struct hdr_info *hdr,
struct menu_lst *menu)
{
struct menu_entry *entry;
! int i = 0;
int rv;
be_node_list_t *be_nodes, *be_node;
rv = be_list(NULL, &be_nodes);
if (rv != BE_SUCCESS)
return;
STAILQ_FOREACH(entry, menu, next) {
! boolean_t active = B_FALSE;
!
for (be_node = be_nodes; be_node;
be_node = be_node->be_next_node)
if (strcmp(be_node->be_root_ds, entry->bootfs) == 0)
! if (be_node->be_active_on_boot)
! active = B_TRUE;
if (parsable)
(void) printf("%d;%s;%s;%s\n", i,
! active == B_TRUE ? "*" : "-",
entry->bootfs, entry->title);
else
(void) printf("%-*d %-*s %-*s %-*s\n",
hdr->cols[0].width, i,
hdr->cols[1].width,
! active == B_TRUE ? "*" : "-",
hdr->cols[2].width, entry->bootfs,
hdr->cols[3].width, entry->title);
+
+ i++;
}
be_free_list(be_nodes);
}
static void