Commit 1f063860 authored by Cheng-Yang Chou's avatar Cheng-Yang Chou Committed by Tejun Heo
Browse files

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: default avatarAndrea Righi <arighi@nvidia.com>
Signed-off-by: default avatarCheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 9d851afa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
		}