mirror of
https://github.com/git/git.git
synced 2026-02-05 15:34:07 +00:00
Win32: fix segfault in WriteConsoleW when debugging in gdb
On Windows XP (not Win7), WriteConsoleW and WriteFile seem to raise and catch SIGSEGV if the lpNumberOfCharsWritten parameter is NULL. This is not a problem when executed standalone, but gdb stops execution here (unless disabled via "handle SIGSEGV nostop"). Fix it by passing a dummy variable. Signed-off-by: Karsten Blees <blees@dcon.de>
This commit is contained in:
committed by
Stepan Kasal
parent
67934f93f5
commit
cd0792afff
@@ -72,7 +72,8 @@ static void warn_if_raster_font(void)
|
||||
L"doesn\'t support Unicode. If you experience strange "
|
||||
L"characters in the output, consider switching to a "
|
||||
L"TrueType font such as Lucida Console!\n";
|
||||
WriteConsoleW(console, msg, wcslen(msg), NULL, NULL);
|
||||
DWORD dummy;
|
||||
WriteConsoleW(console, msg, wcslen(msg), &dummy, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,12 +115,13 @@ static void write_console(unsigned char *str, size_t len)
|
||||
{
|
||||
/* only called from console_thread, so a static buffer will do */
|
||||
static wchar_t wbuf[2 * BUFFER_SIZE + 1];
|
||||
DWORD dummy;
|
||||
|
||||
/* convert utf-8 to utf-16 */
|
||||
int wlen = xutftowcsn(wbuf, (char*) str, ARRAY_SIZE(wbuf), len);
|
||||
|
||||
/* write directly to console */
|
||||
WriteConsoleW(console, wbuf, wlen, NULL, NULL);
|
||||
WriteConsoleW(console, wbuf, wlen, &dummy, NULL);
|
||||
|
||||
/* remember if non-ascii characters are printed */
|
||||
if (wlen != len)
|
||||
|
||||
Reference in New Issue
Block a user