Fix starting tinc as a service on Windows.
Don't assume tincd.exe is in the working directory, especially now that chdir() is called very early. We use GetModuleFileName() instead.
This commit is contained in:
parent
9a66d7499a
commit
83fa44ce42
1 changed files with 3 additions and 6 deletions
|
@ -62,12 +62,9 @@ static bool install_service(void) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strchr(program_name, '\\')) {
|
HMODULE module = GetModuleHandle(NULL);
|
||||||
GetCurrentDirectory(sizeof command - 1, command + 1);
|
GetModuleFileName(module, command + 1, sizeof command - 1);
|
||||||
strncat(command, "\\", sizeof command - strlen(command));
|
command[sizeof command - 1] = 0;
|
||||||
}
|
|
||||||
|
|
||||||
strncat(command, program_name, sizeof command - strlen(command));
|
|
||||||
|
|
||||||
strncat(command, "\"", sizeof command - strlen(command));
|
strncat(command, "\"", sizeof command - strlen(command));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue