agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up write() return type
Date: Wed, 15 Jul 2026 09:05:31 +0000
Message-ID: <E1wjvYZ-000GvH-0I@gemulon.postgresql.org> (raw)

Clean up write() return type

and analogously for pg_pwrite() and FileWrite()

Be sure to store the return value in a variable of type ssize_t, not
int.

Some callers of FileWrite() did not have a separate error message for
a short write.  This is okay in practice because FileWriteV() sets
ENOSPC for all non-error returns, so you'll get a reasonable error
message either way.  But callers handled this inconsistently, and this
behavior isn't really prominently documented and commit 871fe4917e1
seems to frown upon it, so it seems better to make all callers handle
this consistently by adding the separate error message.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1f8c504e3086cf70a1538038b63b045de5df6a9b

Modified Files
--------------
src/backend/access/heap/rewriteheap.c                 | 14 +++++++++-----
src/backend/access/transam/timeline.c                 |  4 ++--
src/backend/access/transam/twophase.c                 | 10 +++++-----
src/backend/access/transam/xlog.c                     |  2 +-
src/backend/backup/basebackup_server.c                |  8 ++++----
src/backend/commands/dbcommands.c                     |  4 ++--
src/backend/libpq/be-fsstubs.c                        |  5 +++--
src/backend/postmaster/fork_process.c                 |  2 +-
.../replication/libpqwalreceiver/libpqwalreceiver.c   |  4 ++--
src/backend/replication/walreceiver.c                 |  4 ++--
src/backend/storage/file/buffile.c                    | 19 ++++++++++---------
src/backend/storage/ipc/waiteventset.c                |  2 +-
src/backend/storage/smgr/md.c                         |  8 ++++----
src/backend/utils/error/elog.c                        |  4 ++--
src/backend/utils/init/miscinit.c                     |  9 +++++----
src/backend/utils/probes.d                            |  2 +-
src/bin/pg_basebackup/pg_recvlogical.c                | 14 +++++++-------
src/bin/pg_basebackup/receivelog.c                    |  4 ++--
src/bin/pg_checksums/pg_checksums.c                   |  6 +++---
src/bin/pg_combinebackup/backup_label.c               | 11 ++++++-----
src/bin/pg_combinebackup/copy_file.c                  |  6 +++---
src/bin/pg_combinebackup/reconstruct.c                |  6 +++---
src/bin/pg_combinebackup/write_manifest.c             |  4 ++--
src/bin/pg_dump/parallel.c                            |  6 +++---
src/bin/pg_test_fsync/pg_test_fsync.c                 |  2 +-
src/fe_utils/cancel.c                                 |  2 +-
src/include/access/timeline.h                         |  2 +-
src/include/replication/walreceiver.h                 |  2 +-
src/interfaces/libpq/fe-lobj.c                        |  5 +++--
src/test/examples/testlo.c                            |  5 +++--
src/test/examples/testlo64.c                          |  5 +++--
31 files changed, 96 insertions(+), 85 deletions(-)



Message-ID: <E1wjvYZ-000GvH-0I@gemulon.postgresql.org>
Permalink:  ../E1wjvYZ-000GvH-0I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wjvYZ-000GvH-0I@gemulon.postgresql.org

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Clean up write() return type
  In-Reply-To: <E1wjvYZ-000GvH-0I@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox