Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: tfo: Fix build warning

Fix

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

by evaluating the return value from read() and displaying an error message
if it reports an error.

Fixes: c65b5bb2329e3 ("selftests: net: add passive TFO test binary")
Cc: David Wei <dw@davidwei.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20251205171010.515236-14-linux@roeck-us.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Guenter Roeck and committed by
Jakub Kicinski
91dc09a6 59546e87

+2 -1
+2 -1
tools/testing/selftests/net/tfo.c
··· 81 81 if (getsockopt(connfd, SOL_SOCKET, SO_INCOMING_NAPI_ID, &opt, &len) < 0) 82 82 error(1, errno, "getsockopt(SO_INCOMING_NAPI_ID)"); 83 83 84 - read(connfd, buf, 64); 84 + if (read(connfd, buf, 64) < 0) 85 + perror("read()"); 85 86 fprintf(outfile, "%d\n", opt); 86 87 87 88 fclose(outfile);