Commit 73447820 authored by Heikki Linnakangas's avatar Heikki Linnakangas

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
parent 623a9ba7
......@@ -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
......
......@@ -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
......
......@@ -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);
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment