postgres.git / summary / log / commit / refs
commit 98bd4c72fd6c4f9d6a2b3b449cb89f335116ab5a
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed May 17 16:55:51 2023 +0000
First released in: 16.0
pg_dump: Have _EndLO report errno after CFH->write_func() failure
Other callers of that function do things this way, but this one didn't
get the memo.
src/bin/pg_dump/pg_backup_directory.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c
index 2177d5ff425..7f2ac7c7fd1 100644
--- a/src/bin/pg_dump/pg_backup_directory.c
+++ b/src/bin/pg_dump/pg_backup_directory.c
@@ -697,7 +697,13 @@ _EndLO(ArchiveHandle *AH, TocEntry *te, Oid oid)
/* register the LO in blobs.toc */
len = snprintf(buf, sizeof(buf), "%u blob_%u.dat\n", oid, oid);
if (!CFH->write_func(buf, len, CFH))
- pg_fatal("could not write to LOs TOC file");
+ {
+ /* if write didn't set errno, assume problem is no disk space */
+ if (errno == 0)
+ errno = ENOSPC;
+ pg_fatal("could not write to LOs TOC file: %s",
+ CFH->get_error_func(CFH));
+ }
}
/*
[parent: 69c430626b5e]