aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-02-25 00:09:26 +0000
committerWarner Losh <imp@FreeBSD.org>2017-02-25 00:09:26 +0000
commit35a419a2cbdc36148de9d6211f1e2051cc2138a1 (patch)
tree90741306288c487199f0a2b8a614f368fd9a63a7
parent589c673b32f7aa1499271a4427a2840d0b000c6a (diff)
downloadsrc-35a419a2cbdc36148de9d6211f1e2051cc2138a1.tar.gz
src-35a419a2cbdc36148de9d6211f1e2051cc2138a1.zip
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
Notes
Notes: svn path=/head/; revision=314232
-rw-r--r--usr.sbin/efivar/efivar.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.sbin/efivar/efivar.c b/usr.sbin/efivar/efivar.c
index 994cc8dfb19e..7801b926978d 100644
--- a/usr.sbin/efivar/efivar.c
+++ b/usr.sbin/efivar/efivar.c
@@ -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)