Lines 266-272
Link Here
|
266 |
const char *beg, *end; |
266 |
const char *beg, *end; |
267 |
char pwd[PATH_MAX]; |
267 |
char pwd[PATH_MAX]; |
268 |
int e, i, len; |
268 |
int e, i, len; |
|
|
269 |
char absfile[PATH_MAX]; |
269 |
|
270 |
|
|
|
271 |
if (file[0] == '/') { /* absolute path requested */ |
272 |
/* do nothing, CWDs will happen properly */ |
273 |
} else if (!strcmp(conn->startpwd, "/")) { /* starting directory is "/" */ |
274 |
snprintf(absfile, PATH_MAX, "/%s", file); |
275 |
file = absfile; |
276 |
} else { /* starting directory was not "/" and relative path requested */ |
277 |
snprintf(absfile, PATH_MAX, "%s/%s", conn->startpwd, file); |
278 |
file = absfile; |
279 |
} |
270 |
/* If no slashes in name, no need to change dirs. */ |
280 |
/* If no slashes in name, no need to change dirs. */ |
271 |
if ((end = strrchr(file, '/')) == NULL) |
281 |
if ((end = strrchr(file, '/')) == NULL) |
272 |
return (0); |
282 |
return (0); |
Lines 1012-1018
Link Here
|
1012 |
goto fouch; |
1022 |
goto fouch; |
1013 |
|
1023 |
|
1014 |
/* TODO: Request extended features supported, if any (RFC 3659). */ |
1024 |
/* TODO: Request extended features supported, if any (RFC 3659). */ |
1015 |
|
1025 |
/* Get starting PWD and store in connection */ |
|
|
1026 |
if ((e = _ftp_cmd(conn, "PWD")) != FTP_WORKING_DIRECTORY || |
1027 |
/* conn->startpwd[] is declared to be PATH_MAX in common.h */ |
1028 |
(e = _ftp_pwd(conn, conn->startpwd, PATH_MAX)) != FTP_OK) |
1029 |
goto fouch; |
1030 |
|
1016 |
/* done */ |
1031 |
/* done */ |
1017 |
return (conn); |
1032 |
return (conn); |
1018 |
|
1033 |
|