mirror of
https://github.com/postgres/postgres.git
synced 2025-09-06 13:46:51 +03:00
Use pg_pwrite() in more places.
This removes some lseek() system calls. Author: Thomas Munro Reviewed-by: Andres Freund Discussion: https://postgr.es/m/CA%2BhUKGJ%2BoHhnvqjn3%3DHro7xu-YDR8FPr0FL6LF35kHRX%3D_bUzg%40mail.gmail.com
This commit is contained in:
@@ -1333,8 +1333,7 @@ AddToDataDirLockFile(int target_line, const char *str)
|
||||
len = strlen(destbuffer);
|
||||
errno = 0;
|
||||
pgstat_report_wait_start(WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE);
|
||||
if (lseek(fd, (off_t) 0, SEEK_SET) != 0 ||
|
||||
(int) write(fd, destbuffer, len) != len)
|
||||
if (pg_pwrite(fd, destbuffer, len, 0) != len)
|
||||
{
|
||||
pgstat_report_wait_end();
|
||||
/* if write didn't set errno, assume problem is no disk space */
|
||||
|
Reference in New Issue
Block a user