Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcedd25a

Browse files
committed
Fix pg_basebackup output to stdout on Windows.
When writing a backup to stdout with pg_basebackup on Windows, put stdoutto binary mode. Any CR bytes in the output will otherwise be outputincorrectly as CR+LF.In the passing, standardize on using "_setmode" instead of "setmode", forthe sake of consistency. They both do the same thing, but according toMSDN documentation, setmode is deprecated.Fixes bug #14634, reported by Henry Boehlert. Patch by Haribabu Kommi.Backpatch to all supported versions.Discussion:https://www.postgresql.org/message-id/20170428082818.24366.13134@wrigleys.postgresql.org
1 parent3b0c2db commitcedd25a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,10 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
806806
*/
807807
if (strcmp(basedir,"-")==0)
808808
{
809+
#ifdefWIN32
810+
_setmode(fileno(stdout),_O_BINARY);
811+
#endif
812+
809813
#ifdefHAVE_LIBZ
810814
if (compresslevel!=0)
811815
{

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,9 +2337,9 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
23372337
(AH->fSpec==NULL||strcmp(AH->fSpec,"")==0))
23382338
{
23392339
if (mode==archModeWrite)
2340-
setmode(fileno(stdout),O_BINARY);
2340+
_setmode(fileno(stdout),O_BINARY);
23412341
else
2342-
setmode(fileno(stdin),O_BINARY);
2342+
_setmode(fileno(stdin),O_BINARY);
23432343
}
23442344
#endif
23452345

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp