aboutsummaryrefslogtreecommitdiffstats
path: root/man2
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-09-04 12:19:16 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-09-05 14:49:42 +0200
commitb40e812a6458503d7abd02c39f5ce7b14b726f17 (patch)
tree8c712c0b2f910adadb8bea026ffd9b390a36ec02 /man2
parent78da9b6b29ce34281971c95647508f8265e775b3 (diff)
downloadman-pages-b40e812a6458503d7abd02c39f5ce7b14b726f17.tar.gz
bind.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> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man2')
-rw-r--r--man2/bind.26
1 files changed, 3 insertions, 3 deletions
diff --git a/man2/bind.2 b/man2/bind.2
index 1aca1a863c..6f1e87774c 100644
--- a/man2/bind.2
+++ b/man2/bind.2
@@ -293,14 +293,14 @@ main(int argc, char *argv[])
if (sfd == \-1)
handle_error("socket");
- memset(&my_addr, 0, sizeof(struct sockaddr_un));
+ memset(&my_addr, 0, sizeof(my_addr));
/* Clear structure */
my_addr.sun_family = AF_UNIX;
strncpy(my_addr.sun_path, MY_SOCK_PATH,
sizeof(my_addr.sun_path) \- 1);
if (bind(sfd, (struct sockaddr *) &my_addr,
- sizeof(struct sockaddr_un)) == \-1)
+ sizeof(my_addr)) == \-1)
handle_error("bind");
if (listen(sfd, LISTEN_BACKLOG) == \-1)
@@ -309,7 +309,7 @@ main(int argc, char *argv[])
/* Now we can accept incoming connections one
at a time using accept(2) */
- peer_addr_size = sizeof(struct sockaddr_un);
+ peer_addr_size = sizeof(peer_addr);
cfd = accept(sfd, (struct sockaddr *) &peer_addr,
&peer_addr_size);
if (cfd == \-1)