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>
This commit is contained in:
Jakub Kicinski 2025-12-10 01:08:51 -08:00
commit 2f6e056e95
3 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,9 @@
CFLAGS += $(KHDR_INCLUDES) -Wall -Wflex-array-member-not-at-end
top_srcdir := ../../../../..
include $(top_srcdir)/scripts/Makefile.compiler
cc-option = $(call __cc-option, $(CC),,$(1),$(2))
CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end)
TEST_GEN_PROGS := \
diag_uid \

View File

@ -24,7 +24,8 @@ static inline void ksft_ready(void)
fd = STDOUT_FILENO;
}
write(fd, msg, sizeof(msg));
if (write(fd, msg, sizeof(msg)) < 0)
perror("write()");
if (fd != STDOUT_FILENO)
close(fd);
}
@ -48,7 +49,8 @@ static inline void ksft_wait(void)
fd = STDIN_FILENO;
}
read(fd, &byte, sizeof(byte));
if (read(fd, &byte, sizeof(byte)) < 0)
perror("read()");
if (fd != STDIN_FILENO)
close(fd);
}

View File

@ -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) < 0)
perror("read()");
fprintf(outfile, "%d\n", opt);
fclose(outfile);