Temporary fixes to scp.exe and sftp.exe to work if started from any directory. Currently they only work if started from their root directory

This commit is contained in:
manojampalam 2016-10-21 22:15:14 -07:00
parent 74db643add
commit 0a91579b94
2 changed files with 9 additions and 0 deletions

4
scp.c
View File

@ -3082,6 +3082,10 @@ int start_process_io(char *exename, char **argv, char **envv,
ctr = 0;
cmdbuf[0] = '\0';
if (argv[0][0] != '\0' && argv[0][1] != ':') {
strcat(cmdbuf, w32_programdir());
strcat(cmdbuf, "\\");
}
while (argv[ctr]) {
strcat_s(cmdbuf, sizeof(cmdbuf), argv[ctr]);
strcat_s(cmdbuf, sizeof(cmdbuf), " ");

5
sftp.c
View File

@ -2219,6 +2219,11 @@ connect_to_server(char *path, char **args, int *in, int *out)
STARTUPINFO si = { 0 };
debug3("Generating ssh-client command...");
fullCmd[0] = '\0';
if (path[0] != '\0' && path[1] != ':') {
strncat(fullCmd, w32_programdir(), MAX_PATH);
strncat(fullCmd, "\\", MAX_PATH);
}
strncat(fullCmd, path, MAX_PATH);
for (i = 1; args[i]; i++)
{