From 702daceea73b6fb1fd25a1dc93ad78ae2f250543 Mon Sep 17 00:00:00 2001 From: dkulwin Date: Tue, 8 Dec 2015 12:47:29 -0600 Subject: [PATCH] Minor changes to assertion handling Changed the code to bring back assertion popups for everyone, but turn off assertions around the _get_osfhandle() call in allocate_sfd(). The original port code was designed knowing that some of the passed parameters would be invalid, but was expecting that the call would just fail instead of generating an assert dialog. Turning off Asserts around this call results in behavior similar to mingw. Also, turn off Incremental Linking for ssh.exe since half the time, the linker would trap on this project. --- contrib/win32/openssh/ssh.vcxproj | 4 ++-- contrib/win32/win32compat/sfds.c | 6 +++++- contrib/win32/win32compat/socket.c | 12 ++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/win32/openssh/ssh.vcxproj b/contrib/win32/openssh/ssh.vcxproj index fd1c06e..4e1afed 100644 --- a/contrib/win32/openssh/ssh.vcxproj +++ b/contrib/win32/openssh/ssh.vcxproj @@ -72,13 +72,13 @@ - true + false $(Platform)\$(Configuration)\$(TargetName)\ ssh $(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\ - true + false $(Platform)\$(Configuration)\$(TargetName)\ ssh $(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\ diff --git a/contrib/win32/win32compat/sfds.c b/contrib/win32/win32compat/sfds.c index 2863cc0..9d762ab 100644 --- a/contrib/win32/win32compat/sfds.c +++ b/contrib/win32/win32compat/sfds.c @@ -32,7 +32,9 @@ #include #include #include "sfds.h" - +#ifndef __MINGW32__ +#include +#endif extern void debug(const char *fmt,...); extern void debug2(const char *fmt,...); @@ -156,12 +158,14 @@ int allocate_sfd(int fd_or_handle) _invalid_parameter_handler oldHandler, newHandler; newHandler = myInvalidParameterHandler; oldHandler = _set_invalid_parameter_handler(newHandler); + int iPrev = _CrtSetReportMode(_CRT_ASSERT, 0); #endif real_handle = (HANDLE)_get_osfhandle(fd_or_handle); #ifndef __MINGW32__ _set_invalid_parameter_handler(oldHandler); + _CrtSetReportMode(_CRT_ASSERT, iPrev); #endif if (real_handle == INVALID_HANDLE_VALUE) diff --git a/contrib/win32/win32compat/socket.c b/contrib/win32/win32compat/socket.c index babcba2..3f7bf5e 100644 --- a/contrib/win32/win32compat/socket.c +++ b/contrib/win32/win32compat/socket.c @@ -2923,12 +2923,12 @@ void WSHELPinitialize() winsock_initialized = 1; #ifndef __MINGW32__ - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); - _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); - _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); + // _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); + // _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); + // _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); + // _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); + // _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); + // _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); #endif