Skip to content

Commit 173486c

Browse files
committed
Fix fopen flags for Windows
1 parent 339bd6d commit 173486c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/data.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
10301030
* go to the next page.
10311031
*/
10321032
if (!headers && fseek(in, read_len, SEEK_CUR) != 0)
1033-
elog(ERROR, "Cannot seek block %u of '%s': %s",
1033+
elog(ERROR, "Cannot seek block %u of \"%s\": %s",
10341034
blknum, from_fullpath, strerror(errno));
10351035
continue;
10361036
}
@@ -1039,7 +1039,7 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
10391039
cur_pos_in != headers[n_hdr].pos)
10401040
{
10411041
if (fseek(in, headers[n_hdr].pos, SEEK_SET) != 0)
1042-
elog(ERROR, "Cannot seek to offset %u of '%s': %s",
1042+
elog(ERROR, "Cannot seek to offset %u of \"%s\": %s",
10431043
headers[n_hdr].pos, from_fullpath, strerror(errno));
10441044

10451045
cur_pos_in = headers[n_hdr].pos;
@@ -1804,7 +1804,7 @@ get_checksum_map(const char *fullpath, uint32 checksum_version,
18041804
char in_buf[STDIO_BUFSIZE];
18051805

18061806
/* open file */
1807-
in = fopen(fullpath, "r+");
1807+
in = fopen(fullpath, "r+b");
18081808
if (!in)
18091809
elog(ERROR, "Cannot open source file \"%s\": %s", fullpath, strerror(errno));
18101810

@@ -1837,11 +1837,11 @@ get_checksum_map(const char *fullpath, uint32 checksum_version,
18371837

18381838
if (rc == PAGE_IS_VALID)
18391839
{
1840-
if (checksum_version)
1841-
checksum_map[blknum].checksum = ((PageHeader) read_buffer)->pd_checksum;
1842-
else
1843-
checksum_map[blknum].checksum = page_st.checksum;
1844-
1840+
// if (checksum_version)
1841+
// checksum_map[blknum].checksum = ((PageHeader) read_buffer)->pd_checksum;
1842+
// else
1843+
// checksum_map[blknum].checksum = page_st.checksum;
1844+
checksum_map[blknum].lsn = page_st.checksum;
18451845
checksum_map[blknum].lsn = page_st.lsn;
18461846
}
18471847
}
@@ -1875,7 +1875,7 @@ get_lsn_map(const char *fullpath, uint32 checksum_version,
18751875
Assert(shift_lsn > 0);
18761876

18771877
/* open file */
1878-
in = fopen(fullpath, "r+");
1878+
in = fopen(fullpath, "r+b");
18791879
if (!in)
18801880
elog(ERROR, "Cannot open source file \"%s\": %s", fullpath, strerror(errno));
18811881

0 commit comments

Comments
 (0)