Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3c3b54

Browse files
committed
Do an explicit fflush after writing a progress message with puts.
This ensures stdout is kept in sync with messages on stderr.Per report from Olaf Ferger.
1 parent8042c79 commitb3c3b54

File tree

6 files changed

+55
-32
lines changed

6 files changed

+55
-32
lines changed

‎src/bin/scripts/clusterdb.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.4 2003/11/29 19:52:07 pgsql Exp $
7+
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -14,14 +14,14 @@
1414
#include"dumputils.h"
1515

1616

17-
static
18-
void
17+
staticvoid
1918
cluster_one_database(constchar*dbname,constchar*table,
20-
constchar*host,constchar*port,constchar*username,boolpassword,
19+
constchar*host,constchar*port,
20+
constchar*username,boolpassword,
2121
constchar*progname,boolecho,boolquiet);
22-
static
23-
void
24-
cluster_all_databases(constchar*host,constchar*port,constchar*username,boolpassword,
22+
staticvoid
23+
cluster_all_databases(constchar*host,constchar*port,
24+
constchar*username,boolpassword,
2525
constchar*progname,boolecho,boolquiet);
2626

2727
staticvoidhelp(constchar*progname);
@@ -151,10 +151,10 @@ main(int argc, char *argv[])
151151
}
152152

153153

154-
static
155-
void
154+
staticvoid
156155
cluster_one_database(constchar*dbname,constchar*table,
157-
constchar*host,constchar*port,constchar*username,boolpassword,
156+
constchar*host,constchar*port,
157+
constchar*username,boolpassword,
158158
constchar*progname,boolecho,boolquiet)
159159
{
160160
PQExpBufferDatasql;
@@ -192,13 +192,16 @@ cluster_one_database(const char *dbname, const char *table,
192192
termPQExpBuffer(&sql);
193193

194194
if (!quiet)
195+
{
195196
puts("CLUSTER");
197+
fflush(stdout);
198+
}
196199
}
197200

198201

199-
static
200-
void
201-
cluster_all_databases(constchar*host,constchar*port,constchar*username,boolpassword,
202+
staticvoid
203+
cluster_all_databases(constchar*host,constchar*port,
204+
constchar*username,boolpassword,
202205
constchar*progname,boolecho,boolquiet)
203206
{
204207
PGconn*conn;

‎src/bin/scripts/createdb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.6 2003/11/29 19:52:07 pgsql Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -177,7 +177,10 @@ main(int argc, char *argv[])
177177
PQfinish(conn);
178178

179179
if (!quiet)
180+
{
180181
puts("CREATE DATABASE");
182+
fflush(stdout);
183+
}
181184

182185
if (comment)
183186
{
@@ -200,7 +203,10 @@ main(int argc, char *argv[])
200203

201204
PQfinish(conn);
202205
if (!quiet)
206+
{
203207
puts("COMMENT");
208+
fflush(stdout);
209+
}
204210
}
205211

206212
exit(0);

‎src/bin/scripts/createuser.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.7 2003/11/29 19:52:07 pgsql Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.8 2004/01/01 19:27:15 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -224,7 +224,10 @@ main(int argc, char *argv[])
224224

225225
PQfinish(conn);
226226
if (!quiet)
227+
{
227228
puts("CREATE USER");
229+
fflush(stdout);
230+
}
228231
exit(0);
229232
}
230233

‎src/bin/scripts/dropdb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.7 2003/11/29 19:52:07 pgsql Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.8 2004/01/01 19:27:15 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -131,7 +131,10 @@ main(int argc, char *argv[])
131131

132132
PQfinish(conn);
133133
if (!quiet)
134+
{
134135
puts("DROP DATABASE");
136+
fflush(stdout);
137+
}
135138
exit(0);
136139
}
137140

‎src/bin/scripts/dropuser.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.6 2003/11/29 19:52:07 pgsql Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -131,7 +131,10 @@ main(int argc, char *argv[])
131131

132132
PQfinish(conn);
133133
if (!quiet)
134+
{
134135
puts("DROP USER");
136+
fflush(stdout);
137+
}
135138
exit(0);
136139
}
137140

‎src/bin/scripts/vacuumdb.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.4 2003/11/29 19:52:07 pgsql Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -14,15 +14,16 @@
1414
#include"common.h"
1515

1616

17-
static
18-
void
19-
vacuum_one_database(constchar*dbname,boolfull,boolverbose,boolanalyze,constchar*table,
20-
constchar*host,constchar*port,constchar*username,boolpassword,
17+
staticvoid
18+
vacuum_one_database(constchar*dbname,boolfull,boolverbose,boolanalyze,
19+
constchar*table,
20+
constchar*host,constchar*port,
21+
constchar*username,boolpassword,
2122
constchar*progname,boolecho,boolquiet);
22-
static
23-
void
23+
staticvoid
2424
vacuum_all_databases(boolfull,boolverbose,boolanalyze,
25-
constchar*host,constchar*port,constchar*username,boolpassword,
25+
constchar*host,constchar*port,
26+
constchar*username,boolpassword,
2627
constchar*progname,boolecho,boolquiet);
2728

2829
staticvoidhelp(constchar*progname);
@@ -168,10 +169,11 @@ main(int argc, char *argv[])
168169
}
169170

170171

171-
static
172-
void
173-
vacuum_one_database(constchar*dbname,boolfull,boolverbose,boolanalyze,constchar*table,
174-
constchar*host,constchar*port,constchar*username,boolpassword,
172+
staticvoid
173+
vacuum_one_database(constchar*dbname,boolfull,boolverbose,boolanalyze,
174+
constchar*table,
175+
constchar*host,constchar*port,
176+
constchar*username,boolpassword,
175177
constchar*progname,boolecho,boolquiet)
176178
{
177179
PQExpBufferDatasql;
@@ -215,14 +217,17 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, c
215217
termPQExpBuffer(&sql);
216218

217219
if (!quiet)
220+
{
218221
puts("VACUUM");
222+
fflush(stdout);
223+
}
219224
}
220225

221226

222-
static
223-
void
227+
staticvoid
224228
vacuum_all_databases(boolfull,boolverbose,boolanalyze,
225-
constchar*host,constchar*port,constchar*username,boolpassword,
229+
constchar*host,constchar*port,
230+
constchar*username,boolpassword,
226231
constchar*progname,boolecho,boolquiet)
227232
{
228233
PGconn*conn;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp