1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +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:
Thomas Munro
2020-02-11 17:22:37 +13:00
parent 2102ba4b58
commit 701a51fd4e
4 changed files with 7 additions and 40 deletions

View File

@ -1868,12 +1868,9 @@ qtext_store(const char *query, int query_len,
if (fd < 0)
goto error;
if (lseek(fd, off, SEEK_SET) != off)
if (pg_pwrite(fd, query, query_len, off) != query_len)
goto error;
if (write(fd, query, query_len) != query_len)
goto error;
if (write(fd, "\0", 1) != 1)
if (pg_pwrite(fd, "\0", 1, off + query_len) != 1)
goto error;
CloseTransientFile(fd);