diff options
| author | Cheng-Yang Chou <yphbchou0911@gmail.com> | 2026-02-22 11:25:22 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-02-23 20:45:10 +0300 |
| commit | 1f0638604f65dae9fc8b6ce937907daf5f0132d0 (patch) | |
| tree | c09a627827116cd8d1a7d31253d087d091af5a2f /tools/testing | |
| parent | 9d851afa482680bdd7c158cc8720284dc9ecb5fe (diff) | |
| download | linux-1f0638604f65dae9fc8b6ce937907daf5f0132d0.tar.xz | |
selftests/sched_ext: Fix unused-result warning for read()
The read() call in run_test() triggers a warn_unused_result compiler
warning, which breaks the build under -Werror.
Check the return value of read() and exit the child process on failure to
satisfy the compiler and handle pipe read errors.
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/sched_ext/init_enable_count.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/sched_ext/init_enable_count.c b/tools/testing/selftests/sched_ext/init_enable_count.c index 82c71653977b..44577e30e764 100644 --- a/tools/testing/selftests/sched_ext/init_enable_count.c +++ b/tools/testing/selftests/sched_ext/init_enable_count.c @@ -57,7 +57,8 @@ static enum scx_test_status run_test(bool global) char buf; close(pipe_fds[1]); - read(pipe_fds[0], &buf, 1); + if (read(pipe_fds[0], &buf, 1) < 0) + exit(1); close(pipe_fds[0]); exit(0); } |
