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:28 +0300 |
commit | aecefffc3f8041c883ab4fb035cf0d5519b5a7ed (patch) | |
tree | 2cfd774e0f21d95623e048820e5e7b351fd1ce5d | |
parent | 4f47c8e7d438a0ae8ea631cd0c3b92db5593901d (diff) | |
download | postgresql-aecefffc3f8041c883ab4fb035cf0d5519b5a7ed.tar.gz postgresql-aecefffc3f8041c883ab4fb035cf0d5519b5a7ed.zip |
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 54bf864efde..ac07a0ef009 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -801,7 +801,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 c4db327a673..4444d040640 100644 --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -165,7 +165,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 59c8695b6bd..3f42ea66274 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -505,7 +505,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); } /* |