| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Clean up write() return type |
| Date: | 2026-07-15 09:05:31 |
| Message-ID: | E1wjvYZ-000GvH-0I@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(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/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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2026-07-15 09:14:02 | pgsql: doc PG 19 relnotes: remove duplicate word |
| Previous Message | Peter Eisentraut | 2026-07-15 07:50:07 | pgsql: Clean up read() return type |