src/backend/utils/sort/logtape.c
/*
 * Write a block-sized buffer to the specified block of the underlying file.
 *
 * NB: should not attempt to write beyond current end of file (ie, create
 * "holes" in file), since BufFile doesn't allow that.  The first write pass
 * must write blocks sequentially.
 *
 * No need for an error return convention; we ereport() on any error.
 */
Write a block-sized buffer to the specified block of the underlying file.
NB: should not attempt to write beyond current end of file , since BufFile doesn't allow that.  The first write pass
must write blocks sequentially.

No need for an error return convention; we ereport() on any error.
Write a block - sized buffer to the specified block of the underlying file . NB : should not attempt to write beyond current end of file since BufFile doesn ' t allow that . The first write pass must write blocks sequentially . No need for an error return convention ; we ereport () on any error .
static void
ltsWriteBlock(LogicalTapeSet *lts, long blocknum, void *buffer)
{
	if (BufFileSeekBlock(lts->pfile, blocknum) != 0 ||
		BufFileWrite(lts->pfile, buffer, BLCKSZ) != BLCKSZ)
		ereport(ERROR,
				(errcode_for_file_access(),
				 errmsg("could not write block %ld of temporary file: %m",
						blocknum)));
}
static void ltsWriteBlock ( LogicalTapeSet * lts , long blocknum , void * buffer ) { if ( BufFileSeekBlock ( lts -> pfile , blocknum ) != 0 || BufFileWrite ( lts -> pfile , buffer , BLCKSZ ) != BLCKSZ ) ereport ( ERROR , ( errcode_for_file_access ( ) , errmsg ( " " , blocknum ) ) ) ; }
Write a block-sized buffer to the specified block of the underlying file.
Write a block - sized buffer to the specified block of the underlying file .