1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-24 11:46:31 +02:00

use setvbuf instead of setbuffer

This commit is contained in:
Grigory Smolkin 2020-03-23 23:59:44 +03:00
parent 0cef487f43
commit 943548c857
3 changed files with 6 additions and 6 deletions

View File

@ -623,7 +623,7 @@ backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
}
if (!fio_is_remote_file(in))
setbuffer(in, in_buffer, STDIO_BUFSIZE);
setvbuf(in, in_buffer, _IOFBF, STDIO_BUFSIZE);
/* open backup file for write */
out = fopen(to_fullpath, PG_BINARY_W);
@ -631,7 +631,7 @@ backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
elog(ERROR, "Cannot open backup file \"%s\": %s",
to_fullpath, strerror(errno));
setbuffer(out, out_buffer, STDIO_BUFSIZE);
setvbuf(out, out_buffer, _IOFBF, STDIO_BUFSIZE);
/* update file permission */
if (chmod(to_fullpath, FILE_PERMISSION) == -1)
@ -874,7 +874,7 @@ restore_data_file(parray *parent_chain, pgFile *dest_file, FILE *out, const char
elog(ERROR, "Cannot open backup file \"%s\": %s", from_fullpath,
strerror(errno));
setbuffer(in, buffer, STDIO_BUFSIZE);
setvbuf(in, buffer, _IOFBF, STDIO_BUFSIZE);
/*
* Restore the file.
@ -1164,7 +1164,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
elog(ERROR, "Cannot open backup file \"%s\": %s", from_fullpath,
strerror(errno));
setbuffer(in, buffer, STDIO_BUFSIZE);
setvbuf(in, buffer, _IOFBF, STDIO_BUFSIZE);
/* do actual work */
restore_non_data_file_internal(in, out, tmp_file, from_fullpath, to_fullpath);

View File

@ -1132,7 +1132,7 @@ merge_data_file(parray *parent_chain, pgBackup *full_backup,
if (out == NULL)
elog(ERROR, "Cannot open merge target file \"%s\": %s",
to_fullpath_tmp1, strerror(errno));
setbuffer(out, buffer, STDIO_BUFSIZE);
setvbuf(out, buffer, _IOFBF, STDIO_BUFSIZE);
/* restore file into temp file */
tmp_file->size = restore_data_file(parent_chain, dest_file, out, to_fullpath_tmp1);

View File

@ -857,7 +857,7 @@ restore_files(void *arg)
goto done;
if (!fio_is_remote_file(out))
setbuffer(out, buffer, STDIO_BUFSIZE);
setvbuf(out, buffer, _IOFBF, STDIO_BUFSIZE);
/* Restore destination file */
if (dest_file->is_datafile && !dest_file->is_cfs)