server: Make it explicit that the setsockopt() return value is ignored
authorBart Van Assche <bvanassche@acm.org>
Sun, 12 Jan 2020 00:31:14 +0000 (16:31 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sun, 12 Jan 2020 02:17:37 +0000 (18:17 -0800)
This patch fixes the following Coverity complaint:

CID 169316 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
5. check_return: Calling setsockopt(sk, 1, 15, &opt, 4U) without checking return value. This library function may fail and return an error code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
server.c

index b7347b43e3961fea588a85ac821811dfff7f61b3..1a070e5678f3359f0f9f3df903467962b14279e0 100644 (file)
--- a/server.c
+++ b/server.c
@@ -2154,7 +2154,8 @@ static int fio_init_server_ip(void)
        /*
         * Not fatal if fails, so just ignore it if that happens
         */
-       setsockopt(sk, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt));
+       if (setsockopt(sk, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt))) {
+       }
 #endif
 
        if (use_ipv6) {