summaryrefslogtreecommitdiff
path: root/src/bin/pg_verifybackup/pg_verifybackup.c
diff options
context:
space:
mode:
authorRobert Haas2024-10-02 13:59:04 +0000
committerRobert Haas2024-10-02 13:59:04 +0000
commitd94cf5ca7fad9cd81af5eac491bfbaf0facb9f6f (patch)
tree757c737bd7d37a01707f15a57257b1f0b34dabb8 /src/bin/pg_verifybackup/pg_verifybackup.c
parent7b2822ecf944a6aa429c05cc7f070001c3817934 (diff)
File size in a backup manifest should use uint64, not size_t.
size_t is the size of an object in memory, not the size of a file on disk. Thanks to Tom Lane for noting the error. Discussion: http://postgr.es/m/[email protected]
Diffstat (limited to 'src/bin/pg_verifybackup/pg_verifybackup.c')
-rw-r--r--src/bin/pg_verifybackup/pg_verifybackup.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c
index 32467a1ba09..0719cb89783 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -61,7 +61,7 @@ static void verifybackup_version_cb(JsonManifestParseContext *context,
static void verifybackup_system_identifier(JsonManifestParseContext *context,
uint64 manifest_system_identifier);
static void verifybackup_per_file_cb(JsonManifestParseContext *context,
- const char *pathname, size_t size,
+ const char *pathname, uint64 size,
pg_checksum_type checksum_type,
int checksum_length,
uint8 *checksum_payload);
@@ -547,7 +547,7 @@ verifybackup_system_identifier(JsonManifestParseContext *context,
*/
static void
verifybackup_per_file_cb(JsonManifestParseContext *context,
- const char *pathname, size_t size,
+ const char *pathname, uint64 size,
pg_checksum_type checksum_type,
int checksum_length, uint8 *checksum_payload)
{
@@ -719,8 +719,9 @@ verify_plain_backup_file(verifier_context *context, char *relpath,
if (m->size != sb.st_size)
{
report_backup_error(context,
- "\"%s\" has size %lld on disk but size %zu in the manifest",
- relpath, (long long int) sb.st_size, m->size);
+ "\"%s\" has size %llu on disk but size %llu in the manifest",
+ relpath, (unsigned long long) sb.st_size,
+ (unsigned long long) m->size);
m->bad = true;
}
@@ -1101,7 +1102,7 @@ verify_file_checksum(verifier_context *context, manifest_file *m,
const char *relpath = m->pathname;
int fd;
int rc;
- size_t bytes_read = 0;
+ uint64 bytes_read = 0;
uint8 checksumbuf[PG_CHECKSUM_MAX_LENGTH];
int checksumlen;
@@ -1164,8 +1165,9 @@ verify_file_checksum(verifier_context *context, manifest_file *m,
if (bytes_read != m->size)
{
report_backup_error(context,
- "file \"%s\" should contain %zu bytes, but read %zu bytes",
- relpath, m->size, bytes_read);
+ "file \"%s\" should contain %llu bytes, but read %llu bytes",
+ relpath, (unsigned long long) m->size,
+ (unsigned long long) bytes_read);
return;
}