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

Commit1a75c1d

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 parent8cde7f4 commit1a75c1d

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
@@ -5019,16 +5019,19 @@ set_random_seed(const char *seed)
50195019
}
50205020
else
50215021
{
5022-
/* parse seed unsigned int value */
5022+
/* parse unsigned-int seed value */
5023+
unsigned longulseed;
50235024
chargarbage;
50245025

5025-
if (sscanf(seed,UINT64_FORMAT"%c",&iseed,&garbage)!=1)
5026+
/* Don't try to use UINT64_FORMAT here; it might not work for sscanf */
5027+
if (sscanf(seed,"%lu%c",&ulseed,&garbage)!=1)
50265028
{
50275029
fprintf(stderr,
50285030
"unrecognized random seed option \"%s\": expecting an unsigned integer, \"time\" or \"rand\"\n",
50295031
seed);
50305032
return false;
50315033
}
5034+
iseed= (uint64)ulseed;
50325035
}
50335036

50345037
if (seed!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp