aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-06-19 12:33:28 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-06-19 12:33:28 +0000
commitfc3c5dae87b74186b99e00a16fbd2e4f7a32a9d1 (patch)
treeea0df0a84e60d7fd6dcda765491a0e62352b7d29 /lib
parent891dffb52848563a1ad45c259ae69c895d599485 (diff)
and fix another flaw in the singlecwd case when we get ftp://site.com/, also
from the #1739100 bug report
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index ce14a4920..30de32f98 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3691,6 +3691,12 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
case FTPFILE_SINGLECWD:
/* get the last slash */
+ if(!path_to_use[0]) {
+ /* no dir, no file */
+ ftpc->dirdepth = 0;
+ ftp->file = NULL;
+ break;
+ }
slash_pos=strrchr(cur_pos, '/');
if(slash_pos || !*cur_pos) {
ftpc->dirs = (char **)calloc(1, sizeof(ftpc->dirs[0]));
@@ -3773,7 +3779,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftp->file = cur_pos; /* the rest is the file name */
}
- if(*ftp->file) {
+ if(ftp->file && *ftp->file) {
ftp->file = curl_easy_unescape(conn->data, ftp->file, 0, NULL);
if(NULL == ftp->file) {
freedirs(conn);