pgsql: Clean up secure_read()/secure_write() return type

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Clean up secure_read()/secure_write() return type
Date: 2026-07-15 06:36:22
Message-ID: E1wjtED-000FxW-2i@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Clean up secure_read()/secure_write() return type

The return type is ssize_t, not int, but some callers didn't handle
this properly.

The BIO callbacks are constrained by the OpenSSL API, so they take int
for the length and return int. This is safe, since the return value
can't be greater than the input length. To make it more clear that
this is intentional, cast the result of the
secure_read()/secure_write() call to int explicitly.

Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Discussion: https://www.postgresql.org/message-id/flat/f9aab072-0078-49e4-ab93-3b08086a4406(at)eisentraut(dot)org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7d45a6dc19743d999f5c83c95ad144a0f2eb6745

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 4 ++--
src/backend/libpq/pqcomm.c | 6 +++---
src/interfaces/libpq/fe-misc.c | 4 ++--
src/interfaces/libpq/fe-secure-openssl.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-07-15 07:50:07 pgsql: Clean up read() return type
Previous Message Michael Paquier 2026-07-15 01:53:54 pgsql: Rework pgstat_write_statsfile() in combination with to_serialize