postgres.git / summary / log / commit / refs

commit    6b8b4e4d8320d8c9daf9410175c40a09e58c4868
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Fri May 06 15:08:48 2016 +0000
First released in: 9.6.0

    Fix pgbench's parsing of double values to notice trailing garbage.
    
    Noted by Fabien Coelho, though this isn't exactly his proposed patch.
    (The technique used here is borrowed from the zic sources.)


src/bin/pgbench/pgbench.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index a4841656fa5..f3c1a0e4159 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -928,8 +928,9 @@ makeVariableNumeric(Variable *var) else /* type should be double */ { double dv; + char xs; - if (sscanf(var->value, "%lf", &dv) != 1) + if (sscanf(var->value, "%lf%c", &dv, &xs) != 1) { fprintf(stderr, "malformed variable \"%s\" value: \"%s\"\n", [parent: 9515299485a5]