Re: [PATCH (2) 10/34] signalfd.2: Use sizeof consistently

Michael Kerrisk (man-pages)
2020-09-04T15:13:39Z

Hello Alex,

On 9/4/20 3:44 PM, Alejandro Colomar wrote:
>>From 9a10e681849a57f75d89cf6943901a3df8097399 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@gmail.com>
> Date: Thu, 3 Sep 2020 21:41:31 +0200
> Subject: [PATCH 10/34] signalfd.2: Use sizeof consistently
>
> Use ``sizeof`` consistently through all the examples in the following
> way:
>
> - Use the name of the variable instead of its type as argument for
> ``sizeof``.
>
> Rationale:
> https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory
>
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>

Patch applied. Thanks.

Michael

> ---
> man2/signalfd.2 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/man2/signalfd.2 b/man2/signalfd.2
> index 96d502a50..92e9fd7ef 100644
> --- a/man2/signalfd.2
> +++ b/man2/signalfd.2
> @@ -502,8 +502,8 @@ main(int argc, char *argv[])
> handle_error("signalfd");
>
> for (;;) {
> - s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo));
> - if (s != sizeof(struct signalfd_siginfo))
> + s = read(sfd, &fdsi, sizeof(fdsi));
> + if (s != sizeof(fdsi))
> handle_error("read");
>
> if (fdsi.ssi_signo == SIGINT) {
>

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/