Fix format string bug in RTC_CHECK facility.
Bug: None Change-Id: I7ba9bb582b30caa4be44b53f94df6efbe60b0000 Reviewed-on: https://webrtc-review.googlesource.com/33000 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21272}
This commit is contained in:
@ -47,6 +47,7 @@
|
||||
#endif
|
||||
|
||||
namespace rtc {
|
||||
namespace {
|
||||
|
||||
void VPrintError(const char* format, va_list args) {
|
||||
#if defined(WEBRTC_ANDROID)
|
||||
@ -56,6 +57,11 @@ void VPrintError(const char* format, va_list args) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
void PrintError(const char* format, ...)
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
#endif
|
||||
|
||||
void PrintError(const char* format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
@ -97,6 +103,8 @@ void DumpBacktrace() {
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
FatalMessage::FatalMessage(const char* file, int line) {
|
||||
Init(file, line);
|
||||
}
|
||||
@ -111,7 +119,7 @@ NO_RETURN FatalMessage::~FatalMessage() {
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
stream_ << std::endl << "#" << std::endl;
|
||||
PrintError(stream_.str().c_str());
|
||||
PrintError("%s", stream_.str().c_str());
|
||||
DumpBacktrace();
|
||||
fflush(stderr);
|
||||
abort();
|
||||
|
Reference in New Issue
Block a user