Commit fd62065f authored by Bruce Momjian's avatar Bruce Momjian

Fix Win32 pg_dumpall, with help from Claudio.

parent 2732932d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/port/exec.c,v 1.18 2004/08/08 02:22:55 momjian Exp $ * $PostgreSQL: pgsql/src/port/exec.c,v 1.19 2004/08/08 03:21:39 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -374,8 +374,7 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize) ...@@ -374,8 +374,7 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize)
CloseHandle(childstdoutrddup); CloseHandle(childstdoutrddup);
return NULL; return NULL;
} }
/* We try just once */ /* We try just once */
if (ReadFile(childstdoutrddup, line, maxsize, &bytesread, NULL) && if (ReadFile(childstdoutrddup, line, maxsize, &bytesread, NULL) &&
bytesread > 0) bytesread > 0)
...@@ -383,6 +382,20 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize) ...@@ -383,6 +382,20 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize)
/* So we read some data */ /* So we read some data */
retval = line; retval = line;
/*
* Sometime the child returns "\r\n", which doesn't match
* our version string. The backend uses
* setvbuf(stdout, NULL, _IONBF, 0), but pg_dump doesn't
* so we have to fix it here.
*/
if (strlen(line) >= 2 &&
line[strlen(line)-2] == '\r' &&
line[strlen(line)-1] == '\n')
{
line[strlen(line)-2] == '\n';
line[strlen(line)-1] == '\0';
}
/* /*
* We emulate fgets() behaviour. So if there is no newline * We emulate fgets() behaviour. So if there is no newline
* at the end, we add one... * at the end, we add one...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment