Skip to content

Commit 7344782

Browse files
committed
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
1 parent 623a9ba commit 7344782

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ progress_report(int tablespacenum, const char *filename,
860860
* Stay on the same line if reporting to a terminal and we're not done
861861
* yet.
862862
*/
863-
fprintf(stderr, (!finished && isatty(fileno(stderr))) ? "\r" : "\n");
863+
fputc((!finished && isatty(fileno(stderr))) ? '\r' : '\n', stderr);
864864
}
865865

866866
static int32

src/bin/pg_checksums/pg_checksums.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ progress_report(bool finished)
166166
* Stay on the same line if reporting to a terminal and we're not done
167167
* yet.
168168
*/
169-
fprintf(stderr, (!finished && isatty(fileno(stderr))) ? "\r" : "\n");
169+
fputc((!finished && isatty(fileno(stderr))) ? '\r' : '\n', stderr);
170170
}
171171

172172
static bool

src/bin/pg_rewind/pg_rewind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ progress_report(bool finished)
572572
* Stay on the same line if reporting to a terminal and we're not done
573573
* yet.
574574
*/
575-
fprintf(stderr, (!finished && isatty(fileno(stderr))) ? "\r" : "\n");
575+
fputc((!finished && isatty(fileno(stderr))) ? '\r' : '\n', stderr);
576576
}
577577

578578
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy