Skip to content

Commit

Permalink
windows: call to FormatMessage() should _IGNORE_INSERTS (#849)
Browse files Browse the repository at this point in the history
Calling FormatMessage without a FORMAT_MESSAGE_IGNORE_INSERTS flag could
cause trouble, as explained in an article by Raymond Chen:

* The importance of the FORMAT_MESSAGE_IGNORE_INSERTS flag
  https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
  • Loading branch information
anpol committed Aug 12, 2022
1 parent 278ed96 commit a1b6164
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/glog/logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ DECLARE_bool(log_utc_time);
LPSTR message = NULL; \
LPSTR msg = reinterpret_cast<LPSTR>(&message); \
DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \
FORMAT_MESSAGE_FROM_SYSTEM, \
FORMAT_MESSAGE_FROM_SYSTEM | \
FORMAT_MESSAGE_IGNORE_INSERTS, \
0, result, 0, msg, 100, NULL); \
if (message_length > 0) { \
@ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, 0, \
Expand Down

0 comments on commit a1b6164

Please sign in to comment.