aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2012-12-21 14:38:33 +0100
committerDaniel Stenberg <daniel@haxx.se>2012-12-21 14:41:54 +0100
commitc30c557e4d2089953339fc669474091bdd505651 (patch)
tree6c9b53b45ed95560e8d088d6e57316014fb85787 /lib
parentd738adc1fbda9e2e545185f9d1b0551fd2d669e6 (diff)
SCP: relative path didn't work
When prefixing a path with /~/ it is supposed to be used relative to the user's home directory but it didn't work. Now we cut off the entire three byte sequenct "/~/" which seems to be how OpenSSH does it. Bug: http://curl.haxx.se/bug/view.cgi?id=1173 Reported by: Balaji Parasuram
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index cb743eb41..1cc4bcd4c 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -422,9 +422,9 @@ static CURLcode ssh_getworkingpath(struct connectdata *conn,
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
- if((working_path_len > 1) && (working_path[1] == '~'))
- /* It is referenced to the home directory, so strip the leading '/' */
- memcpy(real_path, working_path+1, 1 + working_path_len-1);
+ if((working_path_len > 3) && (!memcmp(working_path, "/~/", 3)))
+ /* It is referenced to the home directory, so strip the leading '/~/' */
+ memcpy(real_path, working_path+3, 4 + working_path_len-3);
else
memcpy(real_path, working_path, 1 + working_path_len);
}