From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove setvbuf() call from PQtrace()
Date: Wed, 31 Mar 2021 23:18:53 +0000
Message-ID: <E1lRk6v-0004iu-RN@gemulon.postgresql.org> (raw)
Remove setvbuf() call from PQtrace()
It's misplaced there -- it's not libpq's output stream to tweak in that
way. In particular, POSIX says that it has to be called before any
other operation on the file, so if a stream previously used by the
calling application, bad things may happen.
Put setvbuf() in libpq_pipeline for good measure.
Also, reduce fopen(..., "w+") to just fopen(..., "w") in
libpq_pipeline.c. It's not clear that this fixes anything, but we don't
use w+ anywhere.
Per complaints from Tom Lane.
Discussion: https://postgr.es/m/3337422.1617229905@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6ec578e60101c3c02533f99715945a0400fb3286
Modified Files
--------------
src/interfaces/libpq/fe-trace.c | 2 --
src/test/modules/libpq_pipeline/libpq_pipeline.c | 7 +++++--
2 files changed, 5 insertions(+), 4 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Remove setvbuf() call from PQtrace()
In-Reply-To: <E1lRk6v-0004iu-RN@gemulon.postgresql.org>
References: <E1lRk6v-0004iu-RN@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox