aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_dumpall.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_dumpall.c')
-rw-r--r--src/bin/pg_dump/pg_dumpall.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 3627b69e2a6..36f134137f9 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1564,11 +1564,14 @@ dumpDatabases(PGconn *conn)
static int
runPgDump(const char *dbname, const char *create_opts)
{
- PQExpBuffer connstrbuf = createPQExpBuffer();
- PQExpBuffer cmd = createPQExpBuffer();
+ PQExpBufferData connstrbuf;
+ PQExpBufferData cmd;
int ret;
- appendPQExpBuffer(cmd, "\"%s\" %s %s", pg_dump_bin,
+ initPQExpBuffer(&connstrbuf);
+ initPQExpBuffer(&cmd);
+
+ printfPQExpBuffer(&cmd, "\"%s\" %s %s", pg_dump_bin,
pgdumpopts->data, create_opts);
/*
@@ -1576,27 +1579,27 @@ runPgDump(const char *dbname, const char *create_opts)
* format.
*/
if (filename)
- appendPQExpBufferStr(cmd, " -Fa ");
+ appendPQExpBufferStr(&cmd, " -Fa ");
else
- appendPQExpBufferStr(cmd, " -Fp ");
+ appendPQExpBufferStr(&cmd, " -Fp ");
/*
* Append the database name to the already-constructed stem of connection
* string.
*/
- appendPQExpBuffer(connstrbuf, "%s dbname=", connstr);
- appendConnStrVal(connstrbuf, dbname);
+ appendPQExpBuffer(&connstrbuf, "%s dbname=", connstr);
+ appendConnStrVal(&connstrbuf, dbname);
- appendShellString(cmd, connstrbuf->data);
+ appendShellString(&cmd, connstrbuf.data);
- pg_log_info("running \"%s\"", cmd->data);
+ pg_log_info("running \"%s\"", cmd.data);
fflush(NULL);
- ret = system(cmd->data);
+ ret = system(cmd.data);
- destroyPQExpBuffer(cmd);
- destroyPQExpBuffer(connstrbuf);
+ termPQExpBuffer(&cmd);
+ termPQExpBuffer(&connstrbuf);
return ret;
}