On Tue, 25 Jun 2024 15:21:39 +0000 Abhinav Jain <[email protected]> 
wrote:

> Check the return value from write function to get rid of the warning
> during test compilation, shared below.
> Tested by compiling after the change, the warning disappears.
> 
> proc-empty-vm.c:385:17: warning: ignoring return value of ‘write’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
>   385 |                 write(1, buf, rv);
> 
> ...
>
> --- a/tools/testing/selftests/proc/proc-empty-vm.c
> +++ b/tools/testing/selftests/proc/proc-empty-vm.c
> @@ -382,7 +382,12 @@ static int test_proc_pid_statm(pid_t pid)
>       assert(rv >= 0);
>       assert(rv <= sizeof(buf));
>       if (0) {
> -             write(1, buf, rv);
> +             ssize_t bytes_written = write(1, buf, rv);
> +
> +             if (bytes_written != rv) {
> +                     perror("write");
> +                     return EXIT_FAILURE;
> +             }
>       }

Thanks.  There's a patch queued which simply deletes this code.

https://lkml.kernel.org/r/[email protected]

Reply via email to