Skip to content

Commit 702dace

Browse files
committed
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.
1 parent a08b1c8 commit 702dace

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

contrib/win32/openssh/ssh.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@
7272
</ImportGroup>
7373
<PropertyGroup Label="UserMacros" />
7474
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
75-
<LinkIncremental>true</LinkIncremental>
75+
<LinkIncremental>false</LinkIncremental>
7676
<IntDir>$(Platform)\$(Configuration)\$(TargetName)\</IntDir>
7777
<TargetName>ssh</TargetName>
7878
<OutDir>$(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\</OutDir>
7979
</PropertyGroup>
8080
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
81-
<LinkIncremental>true</LinkIncremental>
81+
<LinkIncremental>false</LinkIncremental>
8282
<IntDir>$(Platform)\$(Configuration)\$(TargetName)\</IntDir>
8383
<TargetName>ssh</TargetName>
8484
<OutDir>$(OpenSSH-Bin-Path)$(Platform)\$(Configuration)\</OutDir>

contrib/win32/win32compat/sfds.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
#include <winsock2.h>
3333
#include <io.h>
3434
#include "sfds.h"
35-
35+
#ifndef __MINGW32__
36+
#include <Crtdbg.h>
37+
#endif
3638

3739
extern void debug(const char *fmt,...);
3840
extern void debug2(const char *fmt,...);
@@ -156,12 +158,14 @@ int allocate_sfd(int fd_or_handle)
156158
_invalid_parameter_handler oldHandler, newHandler;
157159
newHandler = myInvalidParameterHandler;
158160
oldHandler = _set_invalid_parameter_handler(newHandler);
161+
int iPrev = _CrtSetReportMode(_CRT_ASSERT, 0);
159162
#endif
160163

161164

162165
real_handle = (HANDLE)_get_osfhandle(fd_or_handle);
163166
#ifndef __MINGW32__
164167
_set_invalid_parameter_handler(oldHandler);
168+
_CrtSetReportMode(_CRT_ASSERT, iPrev);
165169
#endif
166170

167171
if (real_handle == INVALID_HANDLE_VALUE)

contrib/win32/win32compat/socket.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,12 +2923,12 @@ void WSHELPinitialize()
29232923
winsock_initialized = 1;
29242924

29252925
#ifndef __MINGW32__
2926-
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
2927-
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
2928-
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
2929-
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);
2930-
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
2931-
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
2926+
// _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
2927+
// _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
2928+
// _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
2929+
// _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);
2930+
// _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
2931+
// _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
29322932

29332933
#endif
29342934

0 commit comments

Comments
 (0)