pgsql: Avoid unportable usage of sscanf(UINT64_FORMAT).

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid unportable usage of sscanf(UINT64_FORMAT).
Date: 2014-05-27 02:24:00
Message-ID: E1Wp73Y-0005Dx-0L@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid unportable usage of sscanf(UINT64_FORMAT).

On Mingw, it seems that scanf() doesn't necessarily accept the same format
codes that printf() does, and in particular it may fail to recognize %llu
even though printf() does. Since configure only probes printf() behavior
while setting up the INT64_FORMAT macros, this means it's unsafe to use
those macros with scanf(). We had only one instance of such a coding
pattern, in contrib/pg_stat_statements, so change that code to avoid
the problem.

Per buildfarm warnings. Back-patch to 9.0 where the troublesome code
was introduced.

Michael Paquier

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/c8186b3c223e2abaf51808f7e74e6c03a2511938

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-05-27 03:01:47 pgsql: worker_spi: Initialize bgw_notify_pid in all cases.
Previous Message Tom Lane 2014-05-27 02:23:59 pgsql: Avoid unportable usage of sscanf(UINT64_FORMAT).