Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/efitable/efitable.c
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | if (!got_table) | ||||
xo_errx(EX_DATAERR, "unsupported table"); | xo_errx(EX_DATAERR, "unsupported table"); | ||||
efi_fd = open("/dev/efi", O_RDWR); | efi_fd = open("/dev/efi", O_RDWR); | ||||
if (efi_fd < 0) | if (efi_fd < 0) | ||||
xo_err(EX_OSFILE, "/dev/efi"); | xo_err(EX_OSFILE, "/dev/efi"); | ||||
table.uuid = efi_table_ops[efi_idx].uuid; | table.uuid = efi_table_ops[efi_idx].uuid; | ||||
if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1) | if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1) | ||||
xo_err(EX_OSERR, NULL); | xo_err(EX_OSERR, "EFIIOC_GET_TABLE"); | ||||
kib: I suggest to add something like '(len == 0)' into the string, to distinguish two calls. | |||||
table.buf = malloc(table.table_len); | table.buf = malloc(table.table_len); | ||||
table.buf_len = table.table_len; | table.buf_len = table.table_len; | ||||
if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1) | if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1) | ||||
xo_err(EX_OSERR, NULL); | xo_err(EX_OSERR, "EFIIOC_GET_TABLE"); | ||||
efi_table_ops[efi_idx].parse(table.buf); | efi_table_ops[efi_idx].parse(table.buf); | ||||
close(efi_fd); | close(efi_fd); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
I suggest to add something like '(len == 0)' into the string, to distinguish two calls.