From owner-svn-src-all@freebsd.org Wed Oct 26 08:39:35 2016 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 3655FC21F2E; Wed, 26 Oct 2016 08:39:35 +0000 (UTC) (envelope-from gahr@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 0549321E; Wed, 26 Oct 2016 08:39:34 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9Q8dYn1029073; Wed, 26 Oct 2016 08:39:34 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9Q8dYSM029072; Wed, 26 Oct 2016 08:39:34 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201610260839.u9Q8dYSM029072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Wed, 26 Oct 2016 08:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307958 - stable/11/usr.bin/printenv X-SVN-Group: stable-11 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: Wed, 26 Oct 2016 08:39:35 -0000 Author: gahr (ports committer) Date: Wed Oct 26 08:39:33 2016 New Revision: 307958 URL: https://svnweb.freebsd.org/changeset/base/307958 Log: MFC r307638: Chase a cornercase in printenv and sync its behaviour with builtin's The cornercase is when printenv is passed a parameter in the form VAR=val, where VAR=val exists in the environment. In this case, printenv would print a spurious newline and returns 0. Approved by: cognet MFC after: 1 week Modified: stable/11/usr.bin/printenv/printenv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/printenv/printenv.c ============================================================================== --- stable/11/usr.bin/printenv/printenv.c Wed Oct 26 07:45:48 2016 (r307957) +++ stable/11/usr.bin/printenv/printenv.c Wed Oct 26 08:39:33 2016 (r307958) @@ -83,8 +83,8 @@ main(int argc, char *argv[]) for (ep = environ; *ep; ep++) if (!memcmp(*ep, *argv, len)) { cp = *ep + len; - if (!*cp || *cp == '=') { - (void)printf("%s\n", *cp ? cp + 1 : cp); + if (*cp == '=') { + (void)printf("%s\n", cp + 1); exit(0); } }