From owner-svn-src-all@freebsd.org Sat Apr 16 12:14:46 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 26C90AEDF61; Sat, 16 Apr 2016 12:14:46 +0000 (UTC) (envelope-from jilles@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 ED7EC1156; Sat, 16 Apr 2016 12:14:45 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3GCEjat064925; Sat, 16 Apr 2016 12:14:45 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3GCEjgc064924; Sat, 16 Apr 2016 12:14:45 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201604161214.u3GCEjgc064924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 16 Apr 2016 12:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298109 - head/bin/sh 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.21 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, 16 Apr 2016 12:14:46 -0000 Author: jilles Date: Sat Apr 16 12:14:44 2016 New Revision: 298109 URL: https://svnweb.freebsd.org/changeset/base/298109 Log: sh: Write LINENO value to stack string directly. Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sat Apr 16 07:50:50 2016 (r298108) +++ head/bin/sh/parser.c Sat Apr 16 12:14:44 2016 (r298109) @@ -1610,7 +1610,6 @@ endword: */ parsesub: { - char buf[10]; int subtype; int typeloc; int flags; @@ -1654,12 +1653,15 @@ varname: strncmp(out - length, "LINENO", length) == 0) { /* Replace the variable name with the * current line number. */ + STADJUST(-6, out); + CHECKSTRSPACE(11, out); linno = plinno; if (funclinno != 0) linno -= funclinno - 1; - snprintf(buf, sizeof(buf), "%d", linno); - STADJUST(-6, out); - STPUTS(buf, out); + length = snprintf(out, 11, "%d", linno); + if (length > 10) + length = 10; + out += length; flags |= VSLINENO; } } else if (is_digit(c)) {