[FFmpeg-devel] [PATCH v2 1/2] avformat/network: Return a proper negative error code from ff_network_init()
James Almer
jamrial at gmail.com
Fri Apr 19 20:37:57 EEST 2024
On 4/19/2024 2:23 PM, Andrew Sayers wrote:
> ---
> libavformat/network.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/network.c b/libavformat/network.c
> index f752efc411..d518bb0541 100644
> --- a/libavformat/network.c
> +++ b/libavformat/network.c
> @@ -63,7 +63,7 @@ int ff_network_init(void)
> if (WSAStartup(MAKEWORD(1,1), &wsaData))
> return 0;
> #endif
> - return 1;
> + return -1;
This will make avformat_network_init() fail on all targets but Windows.
Also, there are a lot of ff_network_init() callers that check for 0 as
failure and anything else as success.
What needs to be done is to make ff_network_init() return ff_neterrno()
on WSAStartup() failure and 0 on success on Windows, and 0 for every
other target (where there's no chance of failure), and the callers be
adapted to check for < 0 and propagate the returned error value if so.
> }
>
> int ff_network_wait_fd(int fd, int write)
More information about the ffmpeg-devel
mailing list