1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avformat/ftp: end a directory listing when the data connection ends

ffurl_read() reports the end of the data with AVERROR_EOF, which
ftp_read_dir() passed on as an error instead of ending the listing.

Fixes: avio_list_dir on a directory served by pyftpdlib 2.0.1
Assisted-by: Claude
This commit is contained in:
Michael Niedermayer
2026-10-15 14:40:25 +02:00
committed by michaelni
parent ab3ebee9ea
commit 45f34b7dfe

View File

@@ -1071,9 +1071,9 @@ static int ftp_read_dir(URLContext *h, AVIODirEntry **next)
if (s->dir_buffer_size)
memmove(s->dir_buffer, start, s->dir_buffer_size);
ret = ffurl_read(s->conn_data, s->dir_buffer + s->dir_buffer_size, DIR_BUFFER_SIZE - (s->dir_buffer_size + 1));
if (ret < 0)
if (ret < 0 && ret != AVERROR_EOF)
return ret;
if (!ret) {
if (ret <= 0) {
*next = NULL;
return 0;
}