summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/curl_path.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/curl_path.c')
-rw-r--r--libs/libcurl/src/curl_path.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/libs/libcurl/src/curl_path.c b/libs/libcurl/src/curl_path.c
index 0b2f796d1f..7adc040a22 100644
--- a/libs/libcurl/src/curl_path.c
+++ b/libs/libcurl/src/curl_path.c
@@ -62,24 +62,27 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
}
}
else if((data->conn->handler->protocol & CURLPROTO_SFTP) &&
- (working_path_len > 2) && !memcmp(working_path, "/~/", 3)) {
- size_t len;
- const char *p;
- int copyfrom = 3;
+ (!strcmp("/~", working_path) ||
+ ((working_path_len > 2) && !memcmp(working_path, "/~/", 3)))) {
if(Curl_dyn_add(&npath, homedir)) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
- /* Copy a separating '/' if homedir does not end with one */
- len = Curl_dyn_len(&npath);
- p = Curl_dyn_ptr(&npath);
- if(len && (p[len-1] != '/'))
- copyfrom = 2;
-
- if(Curl_dyn_addn(&npath,
- &working_path[copyfrom], working_path_len - copyfrom)) {
- free(working_path);
- return CURLE_OUT_OF_MEMORY;
+ if(working_path_len > 2) {
+ size_t len;
+ const char *p;
+ int copyfrom = 3;
+ /* Copy a separating '/' if homedir does not end with one */
+ len = Curl_dyn_len(&npath);
+ p = Curl_dyn_ptr(&npath);
+ if(len && (p[len-1] != '/'))
+ copyfrom = 2;
+
+ if(Curl_dyn_addn(&npath,
+ &working_path[copyfrom], working_path_len - copyfrom)) {
+ free(working_path);
+ return CURLE_OUT_OF_MEMORY;
+ }
}
}
@@ -188,7 +191,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
}
return CURLE_OK;
- fail:
+fail:
Curl_safefree(*path);
return CURLE_QUOTE_ERROR;
}