Skip to content

Commit 4d2e94e

Browse files
committed
Ensure fflush(stdout) happens in all cases, per gripe from Jon Sablatnig.
1 parent ecb156d commit 4d2e94e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/bin/psql/mainloop.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.58 2003/11/29 19:52:06 pgsql Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.59 2004/01/21 22:05:44 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "mainloop.h"
@@ -103,7 +103,6 @@ MainLoop(FILE *source)
103103
}
104104

105105
cancel_pressed = false;
106-
fflush(stdout);
107106
}
108107

109108
#ifndef WIN32
@@ -122,7 +121,6 @@ MainLoop(FILE *source)
122121
paren_level = 0;
123122
count_eof = 0;
124123
slashCmdStatus = CMD_UNKNOWN;
125-
fflush(stdout);
126124
}
127125
else
128126
{
@@ -138,6 +136,8 @@ MainLoop(FILE *source)
138136
pqsignal(SIGINT, handle_sigint); /* control-C => cancel */
139137
#endif /* not WIN32 */
140138

139+
fflush(stdout);
140+
141141
if (slashCmdStatus == CMD_NEWEDIT)
142142
{
143143
/*
@@ -161,8 +161,6 @@ MainLoop(FILE *source)
161161
{
162162
int prompt_status;
163163

164-
fflush(stdout);
165-
166164
if (in_quote && in_quote == '\'')
167165
prompt_status = PROMPT_SINGLEQUOTE;
168166
else if (in_quote && in_quote == '"')
@@ -181,7 +179,6 @@ MainLoop(FILE *source)
181179
else
182180
line = gets_fromFile(source);
183181

184-
185182
/* Setting this will not have effect until next line. */
186183
die_on_error = GetVariableBool(pset.vars, "ON_ERROR_STOP");
187184

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy