Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6b8b4e4

Browse files
committed
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.)
1 parent 9515299 commit 6b8b4e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,9 @@ makeVariableNumeric(Variable *var)
928928
else /* type should be double */
929929
{
930930
double dv;
931+
char xs;
931932

932-
if (sscanf(var->value, "%lf", &dv) != 1)
933+
if (sscanf(var->value, "%lf%c", &dv, &xs) != 1)
933934
{
934935
fprintf(stderr,
935936
"malformed variable \"%s\" value: \"%s\"\n",

0 commit comments

Comments
 (0)