Fix to SFTP issue failing to pass in the correct commandline

This commit is contained in:
Manoj Ampalam 2016-12-21 14:16:21 -08:00
parent 07a658c2b7
commit 0efb6c3bf2
1 changed files with 4 additions and 2 deletions

6
sftp.c
View File

@ -313,6 +313,7 @@ static void printf_utf8(char *fmt, ... ) {
/* override mprintf */ /* override mprintf */
#define mprintf(a,...) printf_utf8((a), __VA_ARGS__) #define mprintf(a,...) printf_utf8((a), __VA_ARGS__)
#define printf(a,...) printf_utf8((a), __VA_ARGS__)
#endif /* WINDOWS */ #endif /* WINDOWS */
static void static void
@ -2319,14 +2320,15 @@ connect_to_server(char *path, char **args, int *in, int *out)
cmdlen = strlen(path) + 1; cmdlen = strlen(path) + 1;
for (i = 1; args[i]; i++) for (i = 1; args[i]; i++)
cmdlen += strlen(args[i]) + 1; cmdlen += strlen(args[i]) + 1 + 2;
full_cmd = xmalloc(cmdlen); full_cmd = xmalloc(cmdlen);
full_cmd[0] = '\0'; full_cmd[0] = '\0';
strcat(full_cmd, path); strcat(full_cmd, path);
for (i = 1; args[i]; i++) { for (i = 1; args[i]; i++) {
strcat(full_cmd, " "); strcat(full_cmd, " \"");
strcat(full_cmd, args[i]); strcat(full_cmd, args[i]);
strcat(full_cmd, "\"");
} }
/* disable inheritance on local pipe ends*/ /* disable inheritance on local pipe ends*/