mirror of
https://github.com/curl/curl.git
synced 2026-07-22 16:47:24 +03:00
ftp: refactor a piece of code by merging the repeated part
Closes #19411
This commit is contained in:
parent
1bddfe02d5
commit
a002c50510
1 changed files with 5 additions and 10 deletions
15
lib/ftp.c
15
lib/ftp.c
|
|
@ -2744,16 +2744,6 @@ static CURLcode ftp_pwd_resp(struct Curl_easy *data,
|
|||
free(dir);
|
||||
return result;
|
||||
}
|
||||
free(ftpc->entrypath);
|
||||
ftpc->entrypath = dir; /* remember this */
|
||||
infof(data, "Entry path is '%s'", ftpc->entrypath);
|
||||
/* also save it where getinfo can access it: */
|
||||
free(data->state.most_recent_ftp_entrypath);
|
||||
data->state.most_recent_ftp_entrypath = strdup(ftpc->entrypath);
|
||||
if(!data->state.most_recent_ftp_entrypath)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
ftp_state(data, ftpc, FTP_SYST);
|
||||
return result;
|
||||
}
|
||||
|
||||
free(ftpc->entrypath);
|
||||
|
|
@ -2764,6 +2754,11 @@ static CURLcode ftp_pwd_resp(struct Curl_easy *data,
|
|||
data->state.most_recent_ftp_entrypath = strdup(ftpc->entrypath);
|
||||
if(!data->state.most_recent_ftp_entrypath)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
if(!ftpc->server_os && dir[0] != '/') {
|
||||
ftp_state(data, ftpc, FTP_SYST);
|
||||
return CURLE_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* could not get the path */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue