Re: [PATCH (2) 16/34] getaddrinfo.3: Use sizeof consistently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alex,

On 9/4/20 4:32 PM, Alejandro Colomar wrote:
>>From f926f02eede41183aed7ae279eb333273bd0c8dc Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
> Date: Thu, 3 Sep 2020 21:46:35 +0200
> Subject: [PATCH 16/34] getaddrinfo.3: 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@xxxxxxxxx>

Patch applied. Thanks!

Cheers,

Michael


> ---
>  man3/getaddrinfo.3 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man3/getaddrinfo.3 b/man3/getaddrinfo.3
> index 158fd2e31..70e6b4cc0 100644
> --- a/man3/getaddrinfo.3
> +++ b/man3/getaddrinfo.3
> @@ -721,7 +721,7 @@ main(int argc, char *argv[])
>      /* Read datagrams and echo them back to sender */
> 
>      for (;;) {
> -        peer_addr_len = sizeof(struct sockaddr_storage);
> +        peer_addr_len = sizeof(peer_addr);
>          nread = recvfrom(sfd, buf, BUF_SIZE, 0,
>                  (struct sockaddr *) &peer_addr, &peer_addr_len);
>          if (nread == \-1)
> 


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



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux