Skip to content

Commit bc83d7d

Browse files
author
manojampalam
committed
Fixes to some issues
1 parent 6239a28 commit bc83d7d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

contrib/win32/win32compat/ssh-agent/agent-main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ BOOL WINAPI ctrl_c_handler(
9090
return TRUE;
9191
}
9292

93-
int main(int argc, char **argv) {
94-
93+
int wmain(int argc, wchar_t **argv) {
94+
9595
w32posix_initialize();
9696
load_config();
9797
if (!StartServiceCtrlDispatcherW(dispatch_table)) {
@@ -108,7 +108,7 @@ int main(int argc, char **argv) {
108108
if (argc == 2) {
109109
/*agent process is likely a spawned child*/
110110
char* h = 0;
111-
h += atoi(*(argv + 1));
111+
h += _wtoi(*(argv + 1));
112112
if (h != 0) {
113113
log_init("ssh-agent", config_log_level(), 1, 0);
114114
agent_start(FALSE, TRUE, h);
@@ -146,7 +146,7 @@ int scm_start_service(DWORD num, LPWSTR* args) {
146146
ZeroMemory(&service_status, sizeof(service_status));
147147
service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
148148
ReportSvcStatus(SERVICE_START_PENDING, NO_ERROR, 300);
149-
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
149+
ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0);
150150
log_init("ssh-agent", config_log_level(), 1, 0);
151151
agent_start(FALSE, FALSE, 0);
152152
return 0;

session.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
552552
memcpy(c, command, strlen(command));
553553
c += strlen(command);
554554
}
555-
*c == '\0';
555+
*c = '\0';
556556
}
557557

558558
/* setup Environment varibles */
@@ -561,7 +561,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
561561
char buf[128];
562562
char* laddr;
563563

564-
if ((tmp == utf8_to_utf16(s->pw->pw_name)) != NULL)
564+
if ((tmp = utf8_to_utf16(s->pw->pw_name)) == NULL)
565565
fatal("%s, out of memory");
566566
SetEnvironmentVariableW(L"USERNAME", tmp);
567567
free(tmp);
@@ -579,6 +579,7 @@ int do_exec_windows(Session *s, const char *command, int pty) {
579579
wchar_t wc = pw_dir_w[2];
580580
pw_dir_w[2] = L'\0';
581581
SetEnvironmentVariableW(L"HOMEDRIVE", pw_dir_w);
582+
pw_dir_w[2] = wc;
582583
}
583584

584585
snprintf(buf, sizeof buf, "%.50s %d %d",

0 commit comments

Comments
 (0)