summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2011-03-19 16:38:50 +0100
committerMagnus Hagander <magnus@hagander.net>2011-03-19 16:38:50 +0100
commit4a0014806d909bbb490f568af0b8f1ede06149ed (patch)
tree26bdfd974988eda3fa07ce18957bb711a4825ec6
parent56bb7f2a0275c5e7f17f8fba0d93d12a471869a4 (diff)
Properly clear the verbose output of pg_basebackup
Don't leave partial filename information on the last status or dangling characters if the previous filename was longer than the current one.
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 61aa1d382c6..86ef1d068d7 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -207,11 +207,24 @@ progress_report(int tablespacenum, char *fn)
percent = 100;
if (verbose)
- fprintf(stderr,
- INT64_FORMAT "/" INT64_FORMAT " kB (%i%%) %i/%i tablespaces (%-30s)\r",
- totaldone / 1024, totalsize,
- percent,
- tablespacenum, tablespacecount, fn);
+ {
+ if (!fn)
+
+ /*
+ * No filename given, so clear the status line (used for last
+ * call)
+ */
+ fprintf(stderr,
+ INT64_FORMAT "/" INT64_FORMAT " kB (100%%) %i/%i tablespaces %35s\r",
+ totaldone / 1024, totalsize,
+ tablespacenum, tablespacecount, "");
+ else
+ fprintf(stderr,
+ INT64_FORMAT "/" INT64_FORMAT " kB (%i%%) %i/%i tablespaces (%-30.30s)\r",
+ totaldone / 1024, totalsize,
+ percent,
+ tablespacenum, tablespacecount, fn);
+ }
else
fprintf(stderr, INT64_FORMAT "/" INT64_FORMAT " kB (%i%%) %i/%i tablespaces\r",
totaldone / 1024, totalsize,
@@ -871,7 +884,7 @@ BaseBackup()
if (showprogress)
{
- progress_report(PQntuples(res), "");
+ progress_report(PQntuples(res), NULL);
fprintf(stderr, "\n"); /* Need to move to next line */
}
PQclear(res);