diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 17f14241be..0a88164d84 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1737,13 +1737,14 @@ redirect: goto fail; } } else { + int ret; /* open the tcp connection */ ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, host, port, "?timeout=%d", rt->stimeout); - if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE, - &s->interrupt_callback, NULL) < 0) { - err = AVERROR(EIO); + if ((ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE, + &s->interrupt_callback, NULL)) < 0) { + err = ret; goto fail; } rt->rtsp_hd_out = rt->rtsp_hd;