svn commit: r314231 - head/lib/libefivar

Warner Losh imp at FreeBSD.org
Sat Feb 25 00:09:23 UTC 2017


Author: imp
Date: Sat Feb 25 00:09:21 2017
New Revision: 314231
URL: https://svnweb.freebsd.org/changeset/base/314231

Log:
  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

Modified:
  head/lib/libefivar/efivar.c

Modified: head/lib/libefivar/efivar.c
==============================================================================
--- head/lib/libefivar/efivar.c	Sat Feb 25 00:09:16 2017	(r314230)
+++ head/lib/libefivar/efivar.c	Sat Feb 25 00:09:21 2017	(r314231)
@@ -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));
 }
 


More information about the svn-src-head mailing list