On Mon, 17 Nov 2014, Vittorio Giovara wrote:

CC: [email protected]
Bug-Id: CID 1026742
---
libavformat/network.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 6d308eb..1e5f018 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -235,7 +235,11 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
    int ret;
    int reuse = 1;
    struct pollfd lp = { fd, POLLIN, 0 };
-    setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
+
+    ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
+    if (ret == -1)
+        return AVERROR(errno);
+
    ret = bind(fd, addr, addrlen);
    if (ret)
        return ff_neterrno();
--
1.9.3 (Apple Git-50)

No, not really... if this failed, then sure, it won't be as good as if it wouldn't have failed, but it's no error, we can try to keep going on and see if it works anyway. (Also, for network errors you need to use ff_neterrno().)

Errors here should intentionally be ignored.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to