Added debug mode in ssh-agent

This commit is contained in:
manojampalam 2016-10-26 22:33:17 -07:00
parent 36f6ba825d
commit 2c781ffb0d
2 changed files with 27 additions and 22 deletions

View File

@ -202,6 +202,6 @@ char* w32_programdir() {
int daemon(int nochdir, int noclose)
{
/* this should never be invoked from Windows code*/
DebugBreak();
FreeConsole();
return 0;
}

View File

@ -96,16 +96,21 @@ int wmain(int argc, wchar_t **argv) {
load_config();
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
/*todo - support debug mode*/
/*
if (debugMode) {
SetConsoleCtrlHandler(ctrl_c_handler, TRUE);
if (argc == 2) {
if (wcsncmp(argv[1], L"-ddd", 4) == 0)
log_init("ssh-agent", 7, 1, 1);
else if (wcsncmp(argv[1], L"-dd", 3) == 0)
log_init("ssh-agent", 6, 1, 1);
else if (wcsncmp(argv[1], L"-d", 2) == 0)
log_init("ssh-agent", 5, 1, 1);
if (wcsncmp(argv[1], L"-d", 2) == 0) {
SetConsoleCtrlHandler(ctrl_c_handler, TRUE);
agent_start(TRUE, FALSE, 0);
return 0;
}
*/
if (argc == 2) {
/*agent process is likely a spawned child*/
char* h = 0;
h += _wtoi(*(argv + 1));