Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e5569f

Browse files
committed
Fix unportable code in pgbench.
The buildfarm points out that UINT64_FORMAT might not work with sscanf;it's calibrated for our printf implementation, which might not agreewith the platform-supplied sscanf. Fall back to just accepting anunsigned long, which is already more than the documentation promises.Oversight ine6c3ba7; back-patch to v11, as that was.
1 parent76097b4 commit7e5569f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,16 +4742,19 @@ set_random_seed(const char *seed)
47424742
}
47434743
else
47444744
{
4745-
/* parse seed unsigned int value */
4745+
/* parse unsigned-int seed value */
4746+
unsigned longulseed;
47464747
chargarbage;
47474748

4748-
if (sscanf(seed,UINT64_FORMAT"%c",&iseed,&garbage)!=1)
4749+
/* Don't try to use UINT64_FORMAT here; it might not work for sscanf */
4750+
if (sscanf(seed,"%lu%c",&ulseed,&garbage)!=1)
47494751
{
47504752
fprintf(stderr,
47514753
"unrecognized random seed option \"%s\": expecting an unsigned integer, \"time\" or \"rand\"\n",
47524754
seed);
47534755
return false;
47544756
}
4757+
iseed= (uint64)ulseed;
47554758
}
47564759

47574760
if (seed!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp