Message ID | b87dcbc4-1248-ae80-e47b-dc63324ee6f5@gmail.com |
---|---|
State | Superseded |
Headers | show |
On Sat, Dec 28, 2019 at 01:52:04PM +0300, Fotyev V. wrote: > Add a check for code 550 when requesting file size > --- > libavformat/ftp.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/libavformat/ftp.c b/libavformat/ftp.c > index 97ad80d..64a5250 100644 > --- a/libavformat/ftp.c > +++ b/libavformat/ftp.c > @@ -391,13 +391,17 @@ static int ftp_file_size(FTPContext *s) > char command[CONTROL_BUFFER_SIZE]; > char *res = NULL; > static const int size_codes[] = {213, 0}; > + int resp_code; > > snprintf(command, sizeof(command), "SIZE %s\r\n", s->path); > - if (ftp_send_command(s, command, size_codes, &res) == 213 && res && > strlen(res) > 4) { > + resp_code = ftp_send_command(s, command, size_codes, &res); patch is corrupted by newlines [...] thx
diff --git a/libavformat/ftp.c b/libavformat/ftp.c index 97ad80d..64a5250 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -391,13 +391,17 @@ static int ftp_file_size(FTPContext *s) char command[CONTROL_BUFFER_SIZE]; char *res = NULL; static const int size_codes[] = {213, 0}; + int resp_code; snprintf(command, sizeof(command), "SIZE %s\r\n", s->path); - if (ftp_send_command(s, command, size_codes, &res) == 213 && res && strlen(res) > 4) { + resp_code = ftp_send_command(s, command, size_codes, &res); + if (resp_code == 213 && res && strlen(res) > 4) { s->filesize = strtoll(&res[4], NULL, 10); } else { s->filesize = -1; av_free(res); + if (resp_code == 550) + return AVERROR(ENOENT); return AVERROR(EIO); }