svn commit: r298109 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Sat Apr 16 12:14:46 UTC 2016
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)) {
More information about the svn-src-all
mailing list