Skip to content

Commit 2f6e056

Browse files
committed
Merge branch 'selftests-fix-build-warnings-and-errors' (part)
Guenter Roeck says: ==================== selftests: Fix build warnings and errors This series fixes build warnings and errors observed when trying to build selftests. ==================== Link: https://patch.msgid.link/20251205171010.515236-1-linux@roeck-us.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 9580f6d + 91dc09a commit 2f6e056

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

tools/testing/selftests/net/af_unix/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
CFLAGS += $(KHDR_INCLUDES) -Wall -Wflex-array-member-not-at-end
1+
top_srcdir := ../../../../..
2+
include $(top_srcdir)/scripts/Makefile.compiler
3+
4+
cc-option = $(call __cc-option, $(CC),,$(1),$(2))
5+
6+
CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end)
27

38
TEST_GEN_PROGS := \
49
diag_uid \

tools/testing/selftests/net/lib/ksft.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ static inline void ksft_ready(void)
2424
fd = STDOUT_FILENO;
2525
}
2626

27-
write(fd, msg, sizeof(msg));
27+
if (write(fd, msg, sizeof(msg)) < 0)
28+
perror("write()");
2829
if (fd != STDOUT_FILENO)
2930
close(fd);
3031
}
@@ -48,7 +49,8 @@ static inline void ksft_wait(void)
4849
fd = STDIN_FILENO;
4950
}
5051

51-
read(fd, &byte, sizeof(byte));
52+
if (read(fd, &byte, sizeof(byte)) < 0)
53+
perror("read()");
5254
if (fd != STDIN_FILENO)
5355
close(fd);
5456
}

tools/testing/selftests/net/tfo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ static void run_server(void)
8181
if (getsockopt(connfd, SOL_SOCKET, SO_INCOMING_NAPI_ID, &opt, &len) < 0)
8282
error(1, errno, "getsockopt(SO_INCOMING_NAPI_ID)");
8383

84-
read(connfd, buf, 64);
84+
if (read(connfd, buf, 64) < 0)
85+
perror("read()");
8586
fprintf(outfile, "%d\n", opt);
8687

8788
fclose(outfile);

0 commit comments

Comments
 (0)