[PATCH 13/13] selftests: net: tfo: Fix build error seen with -Werror

Guenter Roeck posted 13 patches 2 months ago
[PATCH 13/13] selftests: net: tfo: Fix build error seen with -Werror
Posted by Guenter Roeck 2 months ago
Fix

tfo.c: In function ‘run_server’:
tfo.c:84:9: error: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’

by evaluating and then ignoring the return value from the read() call.

Fixes: c65b5bb2329e3 ("selftests: net: add passive TFO test binary")
Cc: David Wei <dw@davidwei.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 tools/testing/selftests/net/tfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/tfo.c b/tools/testing/selftests/net/tfo.c
index eb3cac5e583c..0126e600a36b 100644
--- a/tools/testing/selftests/net/tfo.c
+++ b/tools/testing/selftests/net/tfo.c
@@ -81,7 +81,8 @@ static void run_server(void)
 	if (getsockopt(connfd, SOL_SOCKET, SO_INCOMING_NAPI_ID, &opt, &len) < 0)
 		error(1, errno, "getsockopt(SO_INCOMING_NAPI_ID)");
 
-	read(connfd, buf, 64);
+	if (read(connfd, buf, 64))
+		;
 	fprintf(outfile, "%d\n", opt);
 
 	fclose(outfile);
-- 
2.43.0