|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $PostgreSQL: pgsql/src/port/exec.c,v 1.18 2004/08/0802:22:55 momjian Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/port/exec.c,v 1.19 2004/08/0803:21:39 momjian Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -374,15 +374,28 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize) |
374 | 374 | CloseHandle(childstdoutrddup); |
375 | 375 | returnNULL; |
376 | 376 | } |
377 | | - |
378 | | - |
| 377 | + |
379 | 378 | /* We try just once */ |
380 | 379 | if (ReadFile(childstdoutrddup,line,maxsize,&bytesread,NULL)&& |
381 | 380 | bytesread>0) |
382 | 381 | { |
383 | 382 | /* So we read some data */ |
384 | 383 | retval=line; |
385 | 384 |
|
| 385 | +/* |
| 386 | + *Sometime the child returns "\r\n", which doesn't match |
| 387 | + *our version string. The backend uses |
| 388 | + *setvbuf(stdout, NULL, _IONBF, 0), but pg_dump doesn't |
| 389 | + *so we have to fix it here. |
| 390 | + */ |
| 391 | +if (strlen(line) >=2&& |
| 392 | +line[strlen(line)-2]=='\r'&& |
| 393 | +line[strlen(line)-1]=='\n') |
| 394 | +{ |
| 395 | +line[strlen(line)-2]=='\n'; |
| 396 | +line[strlen(line)-1]=='\0'; |
| 397 | +} |
| 398 | + |
386 | 399 | /* |
387 | 400 | *We emulate fgets() behaviour. So if there is no newline |
388 | 401 | *at the end, we add one... |
|