diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-08-18 13:13:09 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-08-18 13:13:09 +0300 |
commit | 734478200ababcbb328ec3f02a74047bc470cae2 (patch) | |
tree | 2bc60ead475e41eedefde17710e839b48a6e1dbb | |
parent | 623a9ba79bbdd11c5eccb30b8bd5c446130e521c (diff) |
Avoid non-constant format string argument to fprintf().
As Tom Lane pointed out, it could defeat the compiler's printf() format
string verification.
Backpatch to v12, like that patch that introduced it.
Discussion: https://www.postgresql.org/message-id/1069283.1597672779%40sss.pgh.pa.us
-rw-r--r-- | src/bin/pg_basebackup/pg_basebackup.c | 2 | ||||
-rw-r--r-- | src/bin/pg_checksums/pg_checksums.c | 2 | ||||
-rw-r--r-- | src/bin/pg_rewind/pg_rewind.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 8158c8e4195..7a5d4562f94 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -860,7 +860,7 @@ progress_report(int tablespacenum, const char *filename, * Stay on the same line if reporting to a terminal and we're not done * yet. */ - fprintf(stderr, (!finished && isatty(fileno(stderr))) ? "\r" : "\n"); + fputc((!finished && isatty(fileno(stderr))) ? '\r' : '\n', stderr); } static int32 diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c index 0696db69bbd..ffdc23945c6 100644 --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -166,7 +166,7 @@ progress_report(bool finished) * Stay on the same line if reporting to a terminal and we're not done * yet. */ - fprintf(stderr, (!finished && isatty(fileno(stderr))) ? "\r" : "\n"); + fputc((!finished && isatty(fileno(stderr))) ? '\r' : '\n', stderr); } static bool diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index a9aecc79052..23fc749e445 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -572,7 +572,7 @@ progress_report(bool finished) * Stay on the same line if reporting to a terminal and we're not done * yet. */ - fprintf(stderr, (!finished && isatty(fileno(stderr))) ? "\r" : "\n"); + fputc((!finished && isatty(fileno(stderr))) ? '\r' : '\n', stderr); } /* |