1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

Fix a bug where a format with leading `-' could be mistaken for printf

getopts argument(s).
This commit is contained in:
Devin Teske 2013-11-07 10:45:25 +00:00
parent f1d6beba07
commit 62c7db8a8a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257790

View File

@ -66,7 +66,8 @@ f_snprintf()
{
local __var_to_set="$1" __size="$2"
shift 2 # var_to_set size
eval "$__var_to_set"=\$\( printf \"\$@\" \| awk -v max=\"\$__size\" \''
eval "$__var_to_set"=\$\( printf -- \"\$@\" \| \
awk -v max=\"\$__size\" \''
{
len = length($0)
max -= len