Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bff41b2

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 b83f1bc commit bff41b2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/bin/pg_basebackup/pg_basebackup.c

+1-1
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

+1-1
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

+1-1
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)