pgsql: Remove setvbuf() call from PQtrace()

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove setvbuf() call from PQtrace()
Date: 2021-03-31 23:18:53
Message-ID: E1lRk6v-0004iu-RN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2021-03-31 23:32:53 pgsql: Add Result Cache executor node
Previous Message Alvaro Herrera 2021-03-31 22:22:07 pgsql: Initialize conn->Pfdebug to NULL when creating a connection