Re: [PATCH] selftests/net: fix unused return value warnings in ksft.h

Jakub Kicinski
2025-09-09T01:20:19Z

On Sat, 06 Sep 2025 23:59:28 +0800 Nai-Chen Cheng wrote:
> The write() and read() system calls in ksft_ready() and ksft_wait()
> functions return values that were not being checked, causing complier
> warnings with GCC.

Is it just a GCC warning or rather a combination of GCC and some
misguided glibc decorator to force check the return of read/write?
Naming the compiler versions and the warning flag which enables
this would be useful. We don't see it building with normal warning
level today.

> Fix the warnings by casting the return values to void to indicate that
> ignoring them is intentional.

> ret = read(fd, &byte, sizeof(byte));
> (void)ret;

Can you not cast the read() to void directly?
--
pw-bot: cr