diff options
author | Warner Losh <imp@FreeBSD.org> | 2017-02-25 00:09:21 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2017-02-25 00:09:21 +0000 |
commit | 589c673b32f7aa1499271a4427a2840d0b000c6a (patch) | |
tree | c2abe6c340556ed82a0d51c5fa4fd25ec4f7fd82 | |
parent | d8fab838afbbaa3ba7c5b16bb82e362798e1bfc7 (diff) | |
download | src-589c673b32f7aa1499271a4427a2840d0b000c6a.tar.gz src-589c673b32f7aa1499271a4427a2840d0b000c6a.zip |
Don't convert ENOENT to nothing for individual lookup, just for the
iterative get_next interface. This prevents efivar(3) from printing 4k
of 0's when a variable isn't set.
Sponsored by: Netflix
Notes
Notes:
svn path=/head/; revision=314231
-rw-r--r-- | lib/libefivar/efivar.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libefivar/efivar.c b/lib/libefivar/efivar.c index 4d485287a6d1..68f6beacc885 100644 --- a/lib/libefivar/efivar.c +++ b/lib/libefivar/efivar.c @@ -132,10 +132,7 @@ rv_to_linux_rv(int rv) { if (rv == 0) rv = 1; - else if (errno == ENOENT) { - rv = 0; - errno = 0; - } else + else rv = -errno; return (rv); } @@ -266,6 +263,11 @@ errout: /* XXX The linux interface expects name to be a static buffer -- fix or leak memory? */ done: + if (errno == ENOENT) { + errno = 0; + return 0; + } + return (rv_to_linux_rv(rv)); } |