aboutsummaryrefslogtreecommitdiffstats
path: root/man7
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-09-03 22:24:12 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-09-05 14:49:42 +0200
commit012b86a0b67fc182c35ab0c8580f47b07a0993ac (patch)
tree0af797e997cee99416fb0e5aca0777353a282da1 /man7
parent0ff1c5e28a8c6376a63990c60f03b3bdd57d5230 (diff)
downloadman-pages-012b86a0b67fc182c35ab0c8580f47b07a0993ac.tar.gz
unix.7: 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 'man7')
-rw-r--r--man7/unix.78
1 files changed, 4 insertions, 4 deletions
diff --git a/man7/unix.7 b/man7/unix.7
index 86a35be7b5..30b0e754d4 100644
--- a/man7/unix.7
+++ b/man7/unix.7
@@ -948,7 +948,7 @@ main(int argc, char *argv[])
* the structure.
*/
- memset(&name, 0, sizeof(struct sockaddr_un));
+ memset(&name, 0, sizeof(name));
/* Bind socket to socket name. */
@@ -956,7 +956,7 @@ main(int argc, char *argv[])
strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) \- 1);
ret = bind(connection_socket, (const struct sockaddr *) &name,
- sizeof(struct sockaddr_un));
+ sizeof(name));
if (ret == \-1) {
perror("bind");
exit(EXIT_FAILURE);
@@ -1082,7 +1082,7 @@ main(int argc, char *argv[])
* the structure.
*/
- memset(&addr, 0, sizeof(struct sockaddr_un));
+ memset(&addr, 0, sizeof(addr));
/* Connect socket to socket address */
@@ -1090,7 +1090,7 @@ main(int argc, char *argv[])
strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) \- 1);
ret = connect(data_socket, (const struct sockaddr *) &addr,
- sizeof(struct sockaddr_un));
+ sizeof(addr));
if (ret == \-1) {
fprintf(stderr, "The server is down.\en");
exit(EXIT_FAILURE);