1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-02-10 14:37:03 +02:00

Arthur Zakirov: fopen() in binary mode

This commit is contained in:
Arthur Zakirov 2018-04-10 18:44:51 +03:00
parent 7e8cffb23f
commit e7665c1d50
2 changed files with 5 additions and 4 deletions

View File

@ -865,7 +865,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
#endif
/* open file for read */
in = fopen(from_path, "r");
in = fopen(from_path, "rb");
if (in == NULL)
elog(ERROR, "Cannot open source WAL file \"%s\": %s", from_path,
strerror(errno));
@ -896,7 +896,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
snprintf(to_path_temp, sizeof(to_path_temp), "%s.partial", to_path);
out = fopen(to_path_temp, "w");
out = fopen(to_path_temp, "wb");
if (out == NULL)
elog(ERROR, "Cannot open destination WAL file \"%s\": %s",
to_path_temp, strerror(errno));
@ -1018,7 +1018,7 @@ get_wal_file(const char *from_path, const char *to_path)
#endif
/* open file for read */
in = fopen(from_path, "r");
in = fopen(from_path, "rb");
if (in == NULL)
{
#ifdef HAVE_LIBZ
@ -1055,7 +1055,7 @@ get_wal_file(const char *from_path, const char *to_path)
/* open backup file for write */
snprintf(to_path_temp, sizeof(to_path_temp), "%s.partial", to_path);
out = fopen(to_path_temp, "w");
out = fopen(to_path_temp, "wb");
if (out == NULL)
elog(ERROR, "Cannot open destination WAL file \"%s\": %s",
to_path_temp, strerror(errno));

View File

@ -514,6 +514,7 @@ extern bool is_pg_running(void);
#define read _read
#define close _close
#define write _write
#define mkdir(dir,mode) _mkdir(dir)
#endif
#endif