[Spice-commits] server/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 17 11:49:18 UTC 2020


 server/tests/test-websocket.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 954eabaeb76a0f93a32210b6bf63157ad2c0fb22
Author: Uri Lublin <uril at redhat.com>
Date:   Wed Jun 17 11:52:05 2020 +0300

    test-websocket: check setsockopt return value
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/tests/test-websocket.c b/server/tests/test-websocket.c
index 2115411e..701f5408 100644
--- a/server/tests/test-websocket.c
+++ b/server/tests/test-websocket.c
@@ -146,7 +146,10 @@ main(int argc, char **argv)
     }
 
     int enable = 1;
-    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
+    if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+                   (const void *) &enable, sizeof(enable)) < 0) {
+        err(1, "setsockopt reuseaddr");
+    }
 
     if (non_blocking) {
         red_socket_set_non_blocking(sock, true);
@@ -200,7 +203,10 @@ handle_client(int new_sock)
     }
 
     int enable = 1;
-    setsockopt(new_sock, IPPROTO_TCP, TCP_NODELAY, (const void *) &enable, sizeof(enable));
+    if (setsockopt(new_sock, IPPROTO_TCP, TCP_NODELAY,
+                   (const void *) &enable, sizeof(enable)) < 0) {
+        err(1, "setsockopt nodelay");
+    }
 
     // wait header
     wait_for(new_sock, POLLIN);


More information about the Spice-commits mailing list