Exit when we can't print a variable.

Exit after printing a message on stderr when we can't get a
message. This is slightly different than linux, but keeps shell
scripts from thinking the value of the variable is the error message
and so is a net win.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-02-25 00:09:26 +00:00
parent 589c673b32
commit 35a419a2cb

View File

@ -205,14 +205,14 @@ print_var(efi_guid_t *guid, char *name)
int rv;
efi_guid_to_str(guid, &gname);
if (!Nflag)
printf("%s-%s", gname, name);
if (pflag) {
rv = efi_get_variable(*guid, name, &data, &datalen, &att);
if (rv < 0)
printf("\n --- Error getting value --- %d", errno);
else {
err(1, "%s-%s", gname, name);
if (!Nflag)
printf("%s-%s", gname, name);
if (Aflag)
asciidump(data, datalen);
else if (bflag)
@ -220,7 +220,6 @@ print_var(efi_guid_t *guid, char *name)
else
hexdump(data, datalen);
}
}
free(gname);
if (!Nflag)
printf("\n");