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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314232

View File

@ -205,21 +205,20 @@ 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 {
if (Aflag)
asciidump(data, datalen);
else if (bflag)
bindump(data, datalen);
else
hexdump(data, datalen);
}
err(1, "%s-%s", gname, name);
if (!Nflag)
printf("%s-%s", gname, name);
if (Aflag)
asciidump(data, datalen);
else if (bflag)
bindump(data, datalen);
else
hexdump(data, datalen);
}
free(gname);
if (!Nflag)