aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-08-08 03:21:39 +0000
committerBruce Momjian <bruce@momjian.us>2004-08-08 03:21:39 +0000
commitfd62065fa613d006647ece9ae1abc965b2cc210d (patch)
treeba820f0e568025f182299bda01431ea3e0ae8bb0 /src
parent2732932de4ebc44136d8cf4f982ffd73ccd66238 (diff)
downloadpostgresql-fd62065fa613d006647ece9ae1abc965b2cc210d.tar.gz
postgresql-fd62065fa613d006647ece9ae1abc965b2cc210d.zip
Fix Win32 pg_dumpall, with help from Claudio.
Diffstat (limited to 'src')
-rw-r--r--src/port/exec.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/port/exec.c b/src/port/exec.c
index b5f41c7971e..30d7a55c1d2 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -7,7 +7,7 @@
*
*
* 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)
CloseHandle(childstdoutrddup);
return NULL;
}
-
-
+
/* We try just once */
if (ReadFile(childstdoutrddup, line, maxsize, &bytesread, NULL) &&
bytesread > 0)
@@ -384,6 +383,20 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize)
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
* at the end, we add one...
*/