From owner-svn-src-all@freebsd.org Sat Feb 25 00:09:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A9D7CEC611; Sat, 25 Feb 2017 00:09:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7EB717B9; Sat, 25 Feb 2017 00:09:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1P09LBD033169; Sat, 25 Feb 2017 00:09:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1P09L9F033168; Sat, 25 Feb 2017 00:09:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201702250009.v1P09L9F033168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 25 Feb 2017 00:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314231 - head/lib/libefivar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2017 00:09:23 -0000 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)); }