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.
/* 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);