projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9515299
)
Fix pgbench's parsing of double values to notice trailing garbage.
author
Tom Lane
Fri, 6 May 2016 15:08:48 +0000
(11:08 -0400)
committer
Tom Lane
Fri, 6 May 2016 15:08:48 +0000
(11:08 -0400)
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
patch
|
blob
|
blame
|
history
diff --git
a/src/bin/pgbench/pgbench.c
b/src/bin/pgbench/pgbench.c
index a4841656fa568c9731e28201e1b1df25644ab25f..f3c1a0e41598e74d2171150d05a7bf7c63df6e09 100644
(file)
--- 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",