sshd service shouldn't call sshd_main() while exiting (#247)

PowerShell/Win32-OpenSSH#957
This commit is contained in:
bagajjal 2017-12-04 10:45:20 -08:00 committed by Manoj Ampalam
parent b7ee9e98e8
commit 5e86ef04c8
1 changed files with 4 additions and 3 deletions

View File

@ -124,13 +124,14 @@ int sshd_main(int argc, wchar_t **wargv) {
}
int wmain(int argc, wchar_t **wargv) {
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
if (GetLastError() != ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
return sshd_main(argc, wargv); /* sshd running NOT as service*/
else
return -1;
}
return sshd_main(argc, wargv);
return 0;
}
int scm_start_service(DWORD num, LPWSTR* args) {