Fix portability and safety issues in pqTraceFormatTimestamp.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 31 Mar 2021 21:00:30 +0000 (17:00 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 31 Mar 2021 21:00:30 +0000 (17:00 -0400)
commitf1be740a991406d7885047beb971e1ff5dbe8b71
treead5014a0c27149149e033a8fd8c27e431bde569b
parent8998e3cafa23632790787b8cc726998e84067259
Fix portability and safety issues in pqTraceFormatTimestamp.

Remove confusion between time_t and pg_time_t; neither
gettimeofday() nor localtime() deal in the latter.
libpq indeed has no business using <pgtime.h> at all.

Use snprintf not sprintf, to ensure we can't overrun the
supplied buffer.  (Unlikely, but let's be safe.)

Per buildfarm.
src/interfaces/libpq/fe-trace.c