Blame SOURCES/0006-test-websocket-check-setsockopt-return-value.patch

ec2abb
From 954eabaeb76a0f93a32210b6bf63157ad2c0fb22 Mon Sep 17 00:00:00 2001
ec2abb
From: Uri Lublin <uril@redhat.com>
ec2abb
Date: Wed, 17 Jun 2020 11:52:05 +0300
ec2abb
Subject: [PATCH] test-websocket: check setsockopt return value
ec2abb
ec2abb
Acked-by: Frediano Ziglio <fziglio@redhat.com>
ec2abb
---
ec2abb
 server/tests/test-websocket.c | 10 ++++++++--
ec2abb
 1 file changed, 8 insertions(+), 2 deletions(-)
ec2abb
ec2abb
diff --git a/server/tests/test-websocket.c b/server/tests/test-websocket.c
ec2abb
index 2115411e..701f5408 100644
ec2abb
--- a/server/tests/test-websocket.c
ec2abb
+++ b/server/tests/test-websocket.c
ec2abb
@@ -146,7 +146,10 @@ main(int argc, char **argv)
ec2abb
     }
ec2abb
 
ec2abb
     int enable = 1;
ec2abb
-    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
ec2abb
+    if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
ec2abb
+                   (const void *) &enable, sizeof(enable)) < 0) {
ec2abb
+        err(1, "setsockopt reuseaddr");
ec2abb
+    }
ec2abb
 
ec2abb
     if (non_blocking) {
ec2abb
         red_socket_set_non_blocking(sock, true);
ec2abb
@@ -200,7 +203,10 @@ handle_client(int new_sock)
ec2abb
     }
ec2abb
 
ec2abb
     int enable = 1;
ec2abb
-    setsockopt(new_sock, SOL_TCP, TCP_NODELAY, (const void *) &enable, sizeof(enable));
ec2abb
+    if (setsockopt(new_sock, SOL_TCP, TCP_NODELAY,
ec2abb
+                   (const void *) &enable, sizeof(enable)) < 0) {
ec2abb
+        err(1, "setsockopt nodelay");
ec2abb
+    }
ec2abb
 
ec2abb
     // wait header
ec2abb
     wait_for(new_sock, POLLIN);
ec2abb
-- 
ec2abb
2.26.2
ec2abb