]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
selftests/sched_ext: Fix unused-result warning for read()
authorCheng-Yang Chou <yphbchou0911@gmail.com>
Sun, 22 Feb 2026 08:25:22 +0000 (16:25 +0800)
committerTejun Heo <tj@kernel.org>
Mon, 23 Feb 2026 17:45:10 +0000 (07:45 -1000)
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>
tools/testing/selftests/sched_ext/init_enable_count.c

index 82c71653977bb5e38dacdca5e2aa78e644f661da..44577e30e764fef872d0d9fd3a17bb2e2e92feb0 100644 (file)
@@ -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);
                }