Skip to content

Commit e1a7d1b

Browse files
committed
Avoid changing stdin/stdout to binary mode on Windows unless that is
really the source or destination of the archive. I think this will resolve recent complaints that password prompting is broken in pg_restore on Windows. Note that password prompting and reading from stdin is an unworkable combination on Windows ... but that was true anyway.
1 parent d134889 commit e1a7d1b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.114 2005/08/23 22:40:31 tgl Exp $
18+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.115 2005/09/11 00:36:14 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -1601,11 +1601,12 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
16011601

16021602
/*
16031603
* On Windows, we need to use binary mode to read/write non-text archive
1604-
* formats. Force stdin/stdout into binary mode in case that is what
1604+
* formats. Force stdin/stdout into binary mode if that is what
16051605
* we are using.
16061606
*/
16071607
#ifdef WIN32
1608-
if (fmt != archNull)
1608+
if (fmt != archNull &&
1609+
(AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0))
16091610
{
16101611
if (mode == archModeWrite)
16111612
setmode(fileno(stdout), O_BINARY);

0 commit comments

Comments
 (0)