Fix another buglet in archive_waldump.c.

While re-reading 860359ea0, I noticed another problem: when
spilling to a temp file, it did not bother to check the result
of fclose().  This is bad since write errors (like ENOSPC)
may not be reported until close time.
This commit is contained in:
Tom Lane 2026-03-22 18:48:38 -04:00
parent 860359ea02
commit 69c57466a7

View file

@ -510,7 +510,9 @@ get_archive_wal_entry(const char *fname, XLogDumpPrivate *privateInfo)
/* Write out the completed WAL file contents to a temp file. */
write_fp = prepare_tmp_write(entry->fname, privateInfo);
perform_tmp_write(entry->fname, entry->buf, write_fp);
fclose(write_fp);
if (fclose(write_fp) != 0)
pg_fatal("could not close file \"%s/%s\": %m",
TmpWalSegDir, entry->fname);
/* resetStringInfo won't release storage, so delete/recreate. */
destroyStringInfo(entry->buf);