@@ -623,15 +623,15 @@ backup_data_file(ConnectionArgs* conn_arg, pgFile *file,
623623 }
624624
625625 if (!fio_is_remote_file (in ))
626- setbuffer (in , in_buffer , STDIO_BUFSIZE );
626+ setvbuf (in , in_buffer , _IOFBF , STDIO_BUFSIZE );
627627
628628 /* open backup file for write */
629629 out = fopen (to_fullpath , PG_BINARY_W );
630630 if (out == NULL )
631631 elog (ERROR , "Cannot open backup file \"%s\": %s" ,
632632 to_fullpath , strerror (errno ));
633633
634- setbuffer (out , out_buffer , STDIO_BUFSIZE );
634+ setvbuf (out , out_buffer , _IOFBF , STDIO_BUFSIZE );
635635
636636 /* update file permission */
637637 if (chmod (to_fullpath , FILE_PERMISSION ) == -1 )
@@ -874,7 +874,7 @@ restore_data_file(parray *parent_chain, pgFile *dest_file, FILE *out, const char
874874 elog (ERROR , "Cannot open backup file \"%s\": %s" , from_fullpath ,
875875 strerror (errno ));
876876
877- setbuffer (in , buffer , STDIO_BUFSIZE );
877+ setvbuf (in , buffer , _IOFBF , STDIO_BUFSIZE );
878878
879879 /*
880880 * Restore the file.
@@ -1164,7 +1164,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
11641164 elog (ERROR , "Cannot open backup file \"%s\": %s" , from_fullpath ,
11651165 strerror (errno ));
11661166
1167- setbuffer (in , buffer , STDIO_BUFSIZE );
1167+ setvbuf (in , buffer , _IOFBF , STDIO_BUFSIZE );
11681168
11691169 /* do actual work */
11701170 restore_non_data_file_internal (in , out , tmp_file , from_fullpath , to_fullpath );
0 commit comments