Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2371776

Browse files
committed
Fix for adding \n for zero-length win32 read_pipe return
1 parent e617fe7 commit 2371776

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/port/exec.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.22 2004/08/16 01:26:31 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.23 2004/08/16 02:46:36 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -402,7 +402,7 @@ static char *pipe_read_line(char *cmd, char *line, int maxsize)
402402
* We emulate fgets() behaviour. So if there is no newline
403403
* at the end, we add one...
404404
*/
405-
if (line[len-1] != '\n')
405+
if (len == 0 || line[len-1] != '\n')
406406
strcat(line,"\n");
407407
}
408408

0 commit comments

Comments
 (0)