postgres.git / summary / log / commit / refs
commit e8f851d61727babe2ce162292b21e6afc89ca65f
Author: Peter Eisentraut <peter@eisentraut.org>
Date: Wed Jul 01 07:39:42 2026 +0000
First released in: 15.19, 16.15, 17.11, 18.6, 19.0
Don't cast off_t to 32-bit type for output, bug fix
off_t is most likely a 64-bit integer, so casting it to a 32-bit type
for output could lose data. There are more issues like this in the
tree, but this is an instance where this could actually happen in
practice, since base backups are routinely larger than 4 GB. So this
is separated out as a bug fix.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/20ce62fa-47fc-457b-b504-12f3c1651726%40eisentraut.org
src/backend/backup/basebackup_server.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/backend/backup/basebackup_server.c b/src/backend/backup/basebackup_server.c
index 0d44a148f01..3d44bf71d19 100644
--- a/src/backend/backup/basebackup_server.c
+++ b/src/backend/backup/basebackup_server.c
@@ -176,9 +176,9 @@ bbsink_server_archive_contents(bbsink *sink, size_t len)
/* short write: complain appropriately */
ereport(ERROR,
(errcode(ERRCODE_DISK_FULL),
- errmsg("could not write file \"%s\": wrote only %d of %zu bytes at offset %u",
+ errmsg("could not write file \"%s\": wrote only %d of %zu bytes at offset %lld",
FilePathName(mysink->file),
- nbytes, len, (unsigned) mysink->filepos),
+ nbytes, len, (long long) mysink->filepos),
errhint("Check free disk space.")));
}
@@ -269,9 +269,9 @@ bbsink_server_manifest_contents(bbsink *sink, size_t len)
/* short write: complain appropriately */
ereport(ERROR,
(errcode(ERRCODE_DISK_FULL),
- errmsg("could not write file \"%s\": wrote only %d of %zu bytes at offset %u",
+ errmsg("could not write file \"%s\": wrote only %d of %zu bytes at offset %lld",
FilePathName(mysink->file),
- nbytes, len, (unsigned) mysink->filepos),
+ nbytes, len, (long long) mysink->filepos),
errhint("Check free disk space.")));
}