1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-04 10:44:46 +02:00

Correctly set binary mode for SSH pipe

This commit is contained in:
Konstantin Knizhnik 2019-04-29 10:56:40 +03:00
parent 16fff38156
commit a490120c16
3 changed files with 9 additions and 16 deletions

View File

@ -679,16 +679,4 @@ extern bool parse_page(Page page, XLogRecPtr *lsn);
int32 do_compress(void* dst, size_t dst_size, void const* src, size_t src_size,
CompressAlg alg, int level, const char **errormsg);
#ifdef WIN32
#ifdef _DEBUG
#define lseek _lseek
#define open _open
#define fstat _fstat
#define read _read
#define close _close
#define write _write
#define mkdir(dir,mode) _mkdir(dir)
#endif
#endif
#endif /* PG_PROBACKUP_H */

View File

@ -3,7 +3,7 @@
#include <sys/stat.h>
#ifdef WIN32
#define __thread
#define __thread __declspec(thread)
#else
#include <pthread.h>
#endif
@ -1258,7 +1258,12 @@ void fio_communicate(int in, int out)
struct stat st;
int rc;
/* Main loop until command of processing master command */
#ifdef WIN32
SYS_CHECK(setmode(in, _O_BINARY));
SYS_CHECK(setmode(out, _O_BINARY));
#endif
/* Main loop until command of processing master command */
while ((rc = fio_read_all(in, &hdr, sizeof hdr)) == sizeof(hdr)) {
if (hdr.size != 0) {
if (hdr.size > buf_size) {

View File

@ -148,8 +148,8 @@ bool launch_agent(void)
}
#ifdef WIN32
SYS_CHECK(_pipe(infd, PIPE_SIZE, O_BINARY)) ;
SYS_CHECK(_pipe(outfd, PIPE_SIZE, O_BINARY));
SYS_CHECK(_pipe(infd, PIPE_SIZE, _O_BINARY)) ;
SYS_CHECK(_pipe(outfd, PIPE_SIZE, _O_BINARY));
ssh_argv[2] = psprintf("%d", outfd[0]);
ssh_argv[3] = psprintf("%d", infd[1]);
{