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