From 0bc574fafe31d5b5419770c5d23837db10958783 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Thu, 20 Jan 2022 00:12:24 +0100 Subject: [PATCH] [rtsp] Coverity fixups --- src/evrtsp/rtsp.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/evrtsp/rtsp.c b/src/evrtsp/rtsp.c index e5d49748..4d467df7 100644 --- a/src/evrtsp/rtsp.c +++ b/src/evrtsp/rtsp.c @@ -1702,13 +1702,23 @@ bind_socket_ai(int family, struct addrinfo *ai, int reuse) } #endif - if (family == AF_INET6) - setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)); + if (family == AF_INET6) { + r = setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)); + if (r == -1) { + event_warn("IPV6_V6ONLY"); + } + } + + r = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof(on)); + if (r == -1) { + event_warn("SO_KEEPALIVE"); + } - setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof(on)); if (reuse) { - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, - (void *)&on, sizeof(on)); + r = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); + if (r == -1) { + event_warn("SO_REUSEADDR"); + } } if (ai != NULL) {